-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem with CHAR(1) version column storing ASCII characters
PostPosted: Mon Apr 06, 2009 10:33 pm 
Newbie

Joined: Mon Apr 06, 2009 9:55 pm
Posts: 12
Hi,

I am using Hibernate 3.1.3 .

In our Oracle 10g legacy database there is an existing VERSION column which is used to implement optimistic locking for existing (non-hibernate) front-end application. This column is inserted/updated by a trigger.

The column stores ASCII characters and whenever the trigger updates the column value, it converts the CHAR value to ASCII code and increments it by 1 or sets the value to 0 if the current ASCII value = Max ASCII code.

Why the CHAR(1) database type was originally used for the VERSION column? Because it takes only one byte in a table row.


I would like to utilise this this column for an optimistic locking in hibernate application. However, hibernate does not support neither string versions nor formula based versions where I could convert ASCII character to numeric ASCII code like in the example below.

Code:
    <version name="version" type="integer" generated="always" insert="false">
        <formula>ASCII(VERSION)</formula>
    </version>


Is there any way to make hibernate to accept this column and not change the type of the VERSION column to numeric type in the database?

Thanks in advance,
Anton








Code:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.