[hibernate-dev] Problem setting the package name using Hibernate Tools.

Sri Gowri gowri_sri at yahoo.com
Wed Jun 4 02:04:43 EDT 2008


Max, 

Thanks for your reply. Comments inline.

> Secondly, even though I have defined the
>HibernateReverseEngineeringStrategy, why tools is generating pojos and mapping
>files for all the tables in the db ? (Note:I have listed only selected tables
>in the hibernate.reveng.xml).

>Not sure - depends what your customer reverse engineeringst rategy does.

I am using the default reverse engineering strategy. Here is the code:

 cfg = new JDBCMetaDataConfiguration();
                OverrideRepository or = new OverrideRepository();
                Configuration c = cfg.configure(confFile); // hibernate.cfg.xml
                or.addFile(revengFile); // hibernate.reveng.xml
                DefaultReverseEngineeringStrategy strategy = new  
                                                            DefaultReverseEngineeringStrategy();
                settings = new ReverseEngineeringSettings(strategy);
                settings.setDefaultPackageName(helper.getPackageName()); // sets package name
                strategy.setSettings(settings);
                cfg.setReverseEngineeringStrategy(strategy);
                cfg.readFromJDBC();


And the hibernate.reveng.xml is 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
  <table-filter exclude="false" match-catalog=".*" match-name="HOTEL" match-schema="TRAVEL"/>
  <table-filter exclude="false" match-catalog=".*" match-name="PERSON" match-schema="TRAVEL"/>
  <table-filter exclude="false" match-catalog=".*" match-name="TRIP" match-schema="TRAVEL"/>
  <table-filter exclude="false" match-catalog=".*" match-name="TRIPTYPE" match-schema="TRAVEL"/>
</hibernate-reverse-engineering>


Only 4 tables are selected as part of the hibernate.reveng.xml. But pojos and mappings are generated for all the tables in the TRAVEL db. Also the selected 4 tables are not dependent on the other tables in the schema.

Is it possible pojo generator/mapping generator is reading all the tables in the schema and ignoring the "selected" tables defined in reveng.xml. And hence creating the additional java and mapping files. 

I would appreciate if you can tell me what I am missing.

Thanks - G






      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080603/c4851d06/attachment.html 


More information about the hibernate-dev mailing list