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.  [ 4 posts ] 
Author Message
 Post subject: many-to-many and Hibernate Tools
PostPosted: Fri Nov 18, 2005 5:21 pm 
Regular
Regular

Joined: Fri Mar 04, 2005 1:33 pm
Posts: 65
Location: U.K.
Hi

I am using HIbernate 3 with Hibernate Tools 3.1 beta 1. I reverse engineer database using hbm2hbmxml task which generates .hbm.xml files. Max from Hibernate team mentioned that many-to-many relation is not supported yet ... e.g.

Table A, B and CR (Cross Reference)
CR has a composite key made of A_id and B_id.

Hibernate Tools task creates .hbm.xml files such a way that A has one-to-many with CR, CR has many-to-one with A.
B has one-to-many with CR, CR has many-to-one with B.

CR being a separate hbm.xml file, eventually produces a separate POJO also. As this extra object being unnecessary and overall code handling CR now been increased I am having second thoughts to go with Hibernate 3 or not.

Like Max said, I looked at JDBCBinder.java and felt like I can not really add required functionality any time soon. Has any one come across similar situation or resolved it ?

Thanks
Ron


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 6:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that the tools currently doesn't support *generation* of many-to-many does not keep you from changing the output to what you want and use Hibernate 3.

Hibernate 3 has fine support for many-to-many.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: many-to-many and H3
PostPosted: Fri Nov 18, 2005 6:28 pm 
Regular
Regular

Joined: Fri Mar 04, 2005 1:33 pm
Posts: 65
Location: U.K.
Actually I thought of doing so. Throughout the project development cycle we anticipate frequent changes to the database schema. If I create hbm.xml files and passivate them and modify manually to handle many-to-many, I have no choice but either manually keep changing hbm.xml everytime any column changes in the database or keep overwriting many-to-many relationship. Either option is not clean. If you have any work around please let me know.

It would be a good idea to have some kind of configurable option for either behavior of cross reference tables.


Thanks
Ron


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 6:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes and that configuration should be implemented in JDBCBinder.

I will probably eventually do it, but right now its not a priority since there is a workaround.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.