[hibernate-dev] Problem setting the package name using Hibernate Tools.
Max Rydahl Andersen
max.andersen at redhat.com
Wed Jun 4 04:28:07 EDT 2008
use the forum where you posted this question twice already.
Thanks,
-max
> 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
>
>
>
>
>
>
>
More information about the hibernate-dev
mailing list