-->
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.  [ 5 posts ] 
Author Message
 Post subject: Using Version for Optimisitic Locking - db requierments
PostPosted: Mon Mar 15, 2004 8:50 pm 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
Does the use of the Version tag in the mapping for a Class for Optimistic Locking require any additional db feature (eg a sequence?), or is the version value or timestamp updated automatically by Hibernate?

Thanks,
Kevin

[This post does not relect the opinions of my Employer or it's clients in any way]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 16, 2004 12:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Hibernate automagically manages any version columns.

[This post does not relect the opinions of me, myself, or I :)]


Top
 Profile  
 
 Post subject: Optimistic Locking with db triggers
PostPosted: Wed Mar 17, 2004 5:31 pm 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
Is there any way to use either the <version> or <timestamp> feature for Optimistic Locking, but to use a database trigger for updating the actual value in the database?

If I use a database trigger does this imply that I have to implement the optimistic locking logic myself (instead of using the version or timestamp feature)?

Thanks, Kevin Hooke


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 5:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Its a problem, 'cos to figure out what value was generated by the trigger, Hibernate has to hit the db again, which is pretty much guaranteed to not perform well. So, I would say that this is not at all a good approach.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 18, 2004 2:14 pm 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
If I use the Timestamp feature in my mapping, where does the timestamp value come from when the column is updated on an update: from Hibernate (ie the app server) or from the database itself?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.