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: Why hibernate reverseEng creates mapping with inverse=true?
PostPosted: Tue Dec 12, 2006 11:06 am 
Newbie

Joined: Sat Oct 15, 2005 5:45 pm
Posts: 18
I'm new to hibernate and hopefully this is a dumb question, when I reverse engineer from the mySQL database the hibernate mapping files that get created have "inverse" set to true.

Although this might be useful, I'm not sure whether I need the bi-directional support and would like to turn this off by default.

Why does it decide to use inverse=true and can I override it?

Example

Membership table (PK is memberID)
LibraryBook table (PK is bookID, FK to membership.memberID)
History table (FK to membership.memberID and libraryBook.bookID)

Another dumb Q, in mySQL we have tried to use the DB admin software to add foreign keys, it seems to always add an index and we can't remove it. Is this because you must have an index for the foreign key? I thought the index's were always optional?

Hibernate version:3

Mapping documents:Generated from database schema

Name and version of the database you are using: Ver 14.12 Distrib 5.0.16, for Win32 (ia32)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 1:47 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
not sure how to turn it off by default, but inverse="true" is a good thing. It's generally helpful if your child objects point towards their parent in the POJOs. In certain cases it can cut down on many db calls as well as assist in navigation.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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.