-->
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: Prefix a sequence
PostPosted: Wed Jun 10, 2009 11:20 am 
Newbie

Joined: Wed Jun 10, 2009 11:03 am
Posts: 3
Hello.
I just started using Hibernate (via Seam) and I need some help with an issue regarding id generation.

I have an Oracle table with a PK that is a value taken from a sequence and prefixed with a character.
For example, if the next sequence value is 1234, I need to assign to the ID column (my PK) the value "A1234".
Could someone please tell me what's the best way to achieve this.
Thank you.


Top
 Profile  
 
 Post subject: Re: Prefix a sequence
PostPosted: Thu Jun 11, 2009 12:24 am 
Newbie

Joined: Tue Jun 09, 2009 11:00 pm
Posts: 2
Hi,

u can query the max(primary key) add +1 to it and append the letter and insert the new record...
this is one way...


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.