Sunday, December 18, 2011

hbm2java: Table TableIdentifier(db.tablename) excluded by strategy

The other day I was trying to reverse engineer a database with the hbm2java plugin. Unfortunately no code was generated. The log stated following:

DEBUG org.hibernate.cfg.reveng.JDBCReader - 
Table TableIdentifier(db.tablename) excluded by strategy

After trying out a few things, I finally found following solution:
In your hibernate.reveng.xml file, set the exclude property to true (exclude="true" in
):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering SYSTEM
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
    <table-filter match-schema="*" match-name="*"
        package="your.package.name.model"
        exclude="true" />
</hibernate-reverse-engineering>

Let me know if it worked for you too!