-->
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: Simple Query:-How do i map two primary keys
PostPosted: Tue Mar 24, 2009 7:02 am 
Newbie

Joined: Tue Feb 24, 2009 6:52 am
Posts: 15
I m using hibernate 3.2.5
I have following problem
I have two primary keys in a a table.

How do i write a constraints in a mapping file of a table which has got two
primary keys.Following is the file ......

<class name="payments" table="payments_tbl">

<id name="paymentId" type="int" column="paymentId" >
<generator class="assigned"/>
</id>

<id name="versionId" type="int" column="versionid" >
<generator class="assigned"/>
</id>

<many-to-one name="employeeId" class="personalDetails" column="employeeId"/>

<many-to-one name="clientMinorId" class="regionsClientsLocationsMappings" column="clientMinorId"/>

<property name="paymentDate">
<column name="paymentDate" />
</property>

<property name="chequeDate">
<column name="chequeDate"/>
</property>

<property name="installmentAmount"


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 24, 2009 7:31 am 
Beginner
Beginner

Joined: Thu Feb 19, 2009 5:48 am
Posts: 37
Location: Glasgow, Scotland
Don't you mean a composite key? If so you're looking for <composite-key>

_________________
##############################
If I helped, rate my comment, I have plenty of stupid questions to ask that I need credit for ;)
##############################


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.