Hi guys,
hbm2java saves me tons of time because I work in an agile environment with frequent, small changes to the data model. Unfortunately I also need custom code in my POJOs and DAOs, which hbm2java likes to overwrite.
The best solution I've seen (see
http://www.onjava.com/pub/a/onjava/2005/12/14/hibernate-class-generation-with-hbm2java.html?page=last) uses generated-class in the mapping file:
Code:
<class name="Owner"...>
<meta attribute="generated-class" inherit="false">BaseOwner</meta>
...
This foces hbm2java to render a class called BaseOwner. Then you create a class "Owner extends BaseOwner" to contain all your custom code, safe from the overwrite. so far so good.
Here's the wrinkle -- when hbm2java finds a second class, say BaseDog, with a many-to-one with Owner, it finds that Owner is undeclared (only BaseOwner exists) and throws a MappingException.
Has anyone successfully implemented this scheme? What am I doing wrong?
Thanks,
G