-->
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: Update check on version number
PostPosted: Sun Apr 18, 2004 10:39 am 
Regular
Regular

Joined: Sun Jan 18, 2004 9:43 am
Posts: 50
Hi all


I have a version number in the table and I would like to know how can I force hibernate check against the version number before updating the record? Should I use the validate() method?

Thank you!

Kind regards

_________________
Edmond Hung
Credit Card DNA Security System (Holdings) Ltd.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 18, 2004 10:52 am 
Regular
Regular

Joined: Wed Mar 03, 2004 9:38 am
Posts: 70
Map the version column as something like:

Code:
<version
            name="version"
            type="int"
            column="version"
        />


and Hibernate will automagically do a version check when updating and deleting.


Top
 Profile  
 
 Post subject: Re: Update check on version number
PostPosted: Sun Apr 18, 2004 10:52 am 
Regular
Regular

Joined: Sun Jan 18, 2004 9:43 am
Posts: 50
I think the validate method doesn't work either because I believe that it is not serialized or locked the record at the database level when it the update is called. Therefore, there could be two updates come at the same time and checked against with the same version number.

_________________
Edmond Hung
Credit Card DNA Security System (Holdings) Ltd.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 18, 2004 12:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
A version property creates an update like
Code:
UPDATE x SET bla=something, version=3 where version=2


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.