-->
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: HELP! optimistic locking doesn't work with null version
PostPosted: Sat Dec 12, 2009 3:12 am 
Newbie

Joined: Sat Dec 12, 2009 2:59 am
Posts: 2
I have an existing table that i am introducing a new column to handle optimistic locking. This column is incremented via a trigger. However since my table currently has many records i am not populating existing records with a version column value. I have defined my mapping as such:

<version name="version" column="VERSION" type="java.lang.Long" generated="always"/>

What i find is that optimistic locking will always fail if the column value in the db is null even if the value in my entity is also null.

Also there is a NullPointerException thrown when hibernate tries to invoke LongType.next() to get the next verison number (i'm not sure why it does this since i thought that since this column is 'generated' hibernate would make a call to the db to get the next version # after a successful update)

Has anyone figured a way to solve this? I'm currently using hibernate 3.1


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.