-->
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.  [ 3 posts ] 
Author Message
 Post subject: Row lock in Web Editing
PostPosted: Wed Nov 19, 2003 9:31 am 
Beginner
Beginner

Joined: Fri Oct 17, 2003 4:11 am
Posts: 40
Hallo,
i'm using JBoss+Hibernate for a database editing application!
I'd like to lock a row when i get it from the database; in this way no one can get this row until the update. But i'd like also to develop a timeout system that release the row after 3 minutes.
Do u have any idea?
Thanx for any help!

Gio


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 9:41 am 
Regular
Regular

Joined: Mon Sep 08, 2003 4:53 am
Posts: 70
Location: Germany
It's not usual to use pessimistic locking in web applications. And there's no way, to say, that you want to lock a record for n seconds. To release the lock, you need to have the connection, which locked the record.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 9:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I agree that this is not a good thing to do. However, you should be able to do it by defining a persistent unlockTime property on your class.

When you lock the object, simply set unlockTime. When another transaction tries to obtain the lock, it should retrieve the object, and check that the current timestamp is either null or < the current time.


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