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

Max Rydahl Andersen max.andersen at redhat.com
Mon Jun 2 10:26:09 EDT 2008


> in the code outputDir is
> C:\Documents and Settings\gowri\MyDocuments\NetBeansProjects\WebApplication57\src\java\Travel.
>
> But the generated pojo and mapping files don't contain package as Travel .

Why should it set the package to travel based on a directory ?

The reverse engineering strategy is what controls the package name.

The default one takes a  ReverseEngineeringSettings which has a set property to set the default package name.

> <class name="Person" table="PERSON" schema="TRAVEL">
>     <id  name="personid" type="int">
>    
>
> class name should be Travel.Person.

Why ?

If you wan't the schema to be used as the package name (we don't since the schema name seldomly relates to the datamodel,
but more to user/access rights) then implement a reverse engineering strategy that takes the schema into consideration.

> Wondering why tools is not setting the package right ?

It does set it right ;)

> 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.

In any case, lets continue this in the user forum.

/max



More information about the hibernate-dev mailing list