-->
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: How to generate a String primary key using sequence?
PostPosted: Fri May 20, 2005 3:52 pm 
Newbie

Joined: Fri May 20, 2005 3:35 pm
Posts: 2
My simple table has a primary key of type String. I would like to use a sequence in oracle, concatenate a String in front, and use the result as the primary key.

The result would be an id of the form CONXXXX where XXXX is the result of the sequence.

Can someone explain how this would be done?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 4:19 pm 
Newbie

Joined: Fri May 20, 2005 4:16 pm
Posts: 13
You could try subclassing SequenceGenerator, then using that in <generator class="">.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 4:36 pm 
Newbie

Joined: Fri May 20, 2005 3:35 pm
Posts: 2
Does anybody have an example of doing something like this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 4:40 pm 
Newbie

Joined: Fri May 20, 2005 4:16 pm
Posts: 13
Why not start using Hibernate's source and working your way from there?

http://cvs.sourceforge.net/viewcvs.py/hibernate/Hibernate3/src/org/hibernate/id/SequenceGenerator.java?rev=1.12&view=auto


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.