-->
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: A small query...!
PostPosted: Mon Sep 29, 2008 10:03 am 
Newbie

Joined: Mon Sep 29, 2008 9:50 am
Posts: 2
Location: india
Respected Sir/madam,

am a beginner in learning Hibernate . starting with the version 3.1.2
using the distribution reference manual as my primary source of information.In the introduction chapter (pdf). page number 13

<set name="emailAddresses" table="PERSON_EMAIL_ADDR">
<key column="PERSON_ID"/>
<element type="string" column="EMAIL_ADDR"/>
</set>

when executed EntityManager class at the database side for the table
PERSON_EMAIL_ADDR only the PERSON_ID is made to primary key and refers(foreign key) to the PERSON TABLE'S PERSON_ID primary key.

another column EMAIL_ADDR is not made to a primary key . But the material says in the next page 14 along with diagram that both the columns act as composite key.

please tell me where i have gone wrong.looking forward for the reply.

_________________
Thanks and Regards,
Kiran


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 11:28 am 
Beginner
Beginner

Joined: Wed Sep 24, 2008 5:44 pm
Posts: 34
Hello, I'm not familiar with the example you're talking about but it sounds like there is a little confusion as to what is what.

I don't think the PERSON_ID is the primary key in the PERSON_EMAIL_ADDR table. The meaning of the properties in the set I think mean something like this:

table="PERSON_EMAIL_ADDR" - In order to get the data from this set, we look at the PERSON_EMAIL_ADDR table
key column="PERSON_ID" - The column PERSON_EMAIL_ADDR.PERSON_ID matches the primary key of the entity we're mapping. This tells us what email address belongs to who
column="EMAIL_ADDR" - Use the values in PERSON_EMAIL_ADDR.EMAIL_ADDR to populate the set.

Because this isn't a one to one relationship, a the email table can't create a primary key on a non-unique column (person_id) it uses the combination of the two to create a PK. Not really sure why it doesn't just have its own PK though. Hope that helps.


Top
 Profile  
 
 Post subject: Not understood..!
PostPosted: Tue Sep 30, 2008 7:28 am 
Newbie

Joined: Mon Sep 29, 2008 9:50 am
Posts: 2
Location: india
please kindly click on the link provided

http://sourceforge.net/project/showfile ... _id=127784

download the version 3.1.2 .zip file , when extracted

{..}\hibernate-3.1.2\hibernate-3.1\doc\reference\en\pdf\hibernate_reference.pdf

this is the manual am following . please i would be very much thankful if u give a glance to the pages 13,14 which refers to my query.

looking forward for ur reply.

_________________
Thanks and Regards,
Kiran


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.