-->
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.  [ 3 posts ] 
Author Message
 Post subject: Another error in Hibernate Reference?
PostPosted: Mon May 26, 2008 3:58 pm 
Beginner
Beginner

Joined: Mon Jul 23, 2007 12:37 pm
Posts: 24
Either I'm having reading problems today, or I found another error. In 1.3.6. Working bi-directional links I read:

Quote:
The rules you have to remember are straightforward: All bi-directional associations need one side as inverse. In a one-to-many association it has to be the many-side, in many-to-many association you can pick either side, there is no difference.

Then, looking at 7.4.1. one to many / many to one I see

Code:
<class name="Person">
    <id name="id" column="personId">
        <generator class="native"/>
    </id>
    <many-to-one name="address"
        column="addressId"
        not-null="true"/>
</class>

<class name="Address">
    <id name="id" column="addressId">
        <generator class="native"/>
    </id>
    <set name="people" inverse="true">
        <key column="addressId"/>
        <one-to-many class="Person"/>
    </set>
</class>


To me, it looks as though many people can live at one address. So people is the many-side, correct? But the inverse attribute is not in Person (=people), but in Address!

Then, in 7.5.1. one to many / many to one I read:

Quote:
Note that the inverse="true" can go on either end of the association, on the collection, or on the join.

How does this all fit together? I guess if a join table is used (§7.5.1), then the first quote does not count. OK - this information should be added in §1.3.6. But what about the many-side mix-up in §7.4.1.?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 4:47 am 
Beginner
Beginner

Joined: Mon Jul 23, 2007 12:37 pm
Posts: 24
OK, just found this thread. So the many-side is the one with many references, in this example the Address. I think this should be made clear in the reference, and also §1.3.6 should incorporate the join table situation.
I have put this in Jira: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3302


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 27, 2008 10:08 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Thanks for the update. The clarification is definitely helpful.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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