-->
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: Hibernate composite id
PostPosted: Sun Aug 06, 2006 1:03 am 
Newbie

Joined: Sat Jul 22, 2006 1:47 pm
Posts: 11
Hi,

I have a table which has two columns as primary key.
How should I composite keys in Hibernate mappings file.

I saw this section in Hibernate Documentation.

"There is an alternative <composite-id> declaration to allow access to legacy data with composite keys. We
strongly discourage its use for anything else."

What does this statement mean. What will be the consequences of using <composite-id>. IS there an alternative way to do this.


Thanking You.
Chamal.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 06, 2006 1:01 pm 
Newbie

Joined: Fri Sep 02, 2005 6:03 pm
Posts: 13
Chamal,

I believe the "alternative approach" implied here is simply use of a single-column primary key. There is further discussion in:

http://www.hibernate.org/hib_docs/reference/en/html/components.html#components-compositeid

I've used composite-id tags in my mapping files without issue. Updates are less efficient. However, upating does seem to work for me. I'm using the "separate class" approach described by the hibernate team.

If your table is just a read-only table, you probably won't have a problem.


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.