-->
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.  [ 4 posts ] 
Author Message
 Post subject: More then just one primary key with annotations
PostPosted: Thu Mar 24, 2005 2:16 pm 
Beginner
Beginner

Joined: Mon Mar 21, 2005 1:39 pm
Posts: 28
Hallo,
i'm using annotations of hibernate, and wanted to know, if I can have more than just one primary key? And how does that work?
I tried this way, but it didn't work (only ID2 is the primary key...)
Code:
@Id
public int getID1() {
  .....
}

@Id
public int getID2(){
  ....
}


Thanks a lot!
Regrads,
Martin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 24, 2005 3:44 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
There is only one primary key for table in relation database

You want unique key, probably - it exists iin annotation

regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 24, 2005 7:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I am assuming you mean compound key and as such the best place to look is in the test package. Not sure its fully implemented as yet since this part is following EJB3.0 spec.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 2:52 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I think that it problem in specification - primary key/id isn't field's/column's features than class/table's

regards


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