-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: preserving custom code with hbm2java
PostPosted: Thu Oct 11, 2007 4:53 pm 
Newbie

Joined: Mon Oct 01, 2007 11:50 am
Posts: 4
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.