-->
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: How to use generator class="increment" for VARCHAR
PostPosted: Fri Mar 05, 2004 3:16 pm 
Newbie

Joined: Fri Mar 05, 2004 3:05 pm
Posts: 1
Location: TORONTO
Hi,

I have two problems when implementing Hiberate (2.1) in my app.

1) I have an Oracle 9i table with a PK column of VARCHAR2(10). Basically this column contains order Id and it must contain only digits. Order numbers are created sequentially and left-padded with 0. Can "increment" be used in this case (the hibernate documentation indicates that the column must be int or long) ? If not, what other alternatives are available ?

2) Another table similar to (1) except that the ID must be prefixed with a three-character prefix "OMC". The rest of the ID characters are digits and must be sequential. What generator class should be used ?

I have searched the doc and this forum but cannot find any hint on these problems.

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 5:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Just write a couple of custom types, to convert the Integer in your object model to a db VARCHAR.


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.