-->
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: two primary keys in one table
PostPosted: Wed Nov 18, 2009 12:46 am 
Newbie

Joined: Thu Nov 06, 2008 3:42 am
Posts: 15
Hi,
I have a table Schoole Profile table in which there are two keys
1. id
2. schname.

For this how should my .hbm.xml. file look like?
Do I have to have two <id> tags one for each? I tried this but it gave an error.

Would you please suggest how to have the xml?


Top
 Profile  
 
 Post subject: Re: two primary keys in one table
PostPosted: Wed Nov 18, 2009 6:03 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Will <composite-id> solve your problem. Composite id helps you map more than one column to be ur key.

Code:
<composite-id>
        <key-property name="medicareNumber"/>
        <key-property name="dependent"/>
</composite-id>


You may check out the complete details at:
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-declaration-compositeid

_________________
Sukirtha


Top
 Profile  
 
 Post subject: Re: two primary keys in one table
PostPosted: Wed Nov 18, 2009 6:33 am 
Newbie

Joined: Thu Nov 06, 2008 3:42 am
Posts: 15
Hi All,
There is a very mundane error in data base concepts. I don't think you can have two primary keys in one table
Sorry all for this stupid DUMB question.

Kind Regards,
Sham.


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.