-->
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.  [ 2 posts ] 
Author Message
 Post subject: Many to many "owning" side with code gen
PostPosted: Mon Jan 11, 2010 9:45 pm 
Newbie

Joined: Mon Jan 11, 2010 9:38 pm
Posts: 1
Hello,

I've searched the documentation and forums and haven't yet found an answer to my question. Sorry if it has been posted already.

I'm wondering how to tell hibernate code generation which side of a many-to-many link "owns" the association. In other words which side should be "inverse=false" and which should be "inverse=true". I am reverse engineering the .hbm.xml files and POJOs from the JDBC connection specified in my hibernate.cfg.xml file. As of now the code generation makes both "inverse=false".

Any help is greatly appreciated. Thanks,
Mike


Top
 Profile  
 
 Post subject: Re: Many to many "owning" side with code gen
PostPosted: Thu Feb 18, 2010 12:21 pm 
Newbie

Joined: Thu Feb 18, 2010 12:11 pm
Posts: 1
Hi,

I had a similar problem and implemented an org.hibernate.cfg.reveng.ReverseEngineeringStrategy, especially its isForeignKeyCollectionInverse method (see http://docs.jboss.org/tools/2.1.0.Beta1/hibernatetools/html_single/#custom-reveng-strategy). You could check whether the second parameter of the isForeignKeyCollectionInverse method is a many-to-many table (via isManyToManyTable()) and further apply your own criteria.

Cheers, Frank


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

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.