-->
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: hibernate composite key containing sequence number
PostPosted: Sat Jun 26, 2004 6:24 pm 
Newbie

Joined: Sat Jun 26, 2004 6:01 pm
Posts: 6
Just jumped into Hibernate - following is a typical newbie question

software used:
latest version of hibernate
Oracle 9i database
jdk 1.4

I have a table called
txn_log
transaction_id number pk
status_cd varchar2(5) pk
message clob
.....etc

I would like to know what settings need to be done in the mapping xml file for this table to support this composite primary key? I went through some examples which shows how to deal with tables with just one field as primary key where the primary key is an auto increment in oracle.

Any sample snippet of the xml, tips, pointers etc would be helpful.

Thanks
Pradeep


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 8:54 pm 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:21 pm
Posts: 44
Location: Boston
Section 5.1.5 in the reference manual deals with this:

http://www.hibernate.org/hib_docs/refer ... ompositeid


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 4:29 pm 
Newbie

Joined: Sat Jun 26, 2004 6:01 pm
Posts: 6
below information is posted in Hibernate Users FAQ - Advanced Problems
This addresses my requirement.

I have a composite key where one column holds a generated value - how can I get Hibernate to generate and assign the value?

We regard this as an extremely strange thing to want to do. If you have a generated surrogate key, why not just make it be the primary key?

However, if you must do this, you can do it by writing a CompositeUserType for the composite identifier class, and then defining a custom IdentifierGenerator that populates the generated value into the composite key class.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 2:06 pm 
Newbie

Joined: Tue Aug 08, 2006 3:50 pm
Posts: 4
any luck with the prob

i am having the same problem


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.