-->
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: How to do a full table lock (preventing inserts)?
PostPosted: Fri Feb 17, 2006 2:50 pm 
Newbie

Joined: Thu Jan 19, 2006 1:08 pm
Posts: 3
Does anyone know how to do a full table lock in Hibernate?

I have to do some business validations on the existing data before I insert my object, but I want to prevent any inserts while I'm in the process of validation.

Or is there a better way to do this?

Thanks!

José


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 5:22 pm 
Newbie

Joined: Fri Feb 17, 2006 4:01 pm
Posts: 1
Location: Monrovia, CA
I have the same question. I see how I can apply a lock to a single object (row), but how do I lock a table against reads while I update it?

If I'm about to add a row with data that's derived from the existing data, I don't want another process doing the same thing.

Mojo

_________________
Morris Jones
Monrovia, CA
http://www.whiteoaks.com


Top
 Profile  
 
 Post subject: Re: How to do a full table lock (preventing inserts)?
PostPosted: Sun Mar 22, 2009 6:31 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 8:38 am
Posts: 37
Since a Hibernate session allows you to execute SQL directly, why not use that to execute something like “LOCK TABLE <tablename>…” ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 22, 2009 11:23 pm 
Newbie

Joined: Mon Nov 26, 2007 4:10 pm
Posts: 6
While locking the table will work - the process of locking an entire table just doesn't seem right. There must be other ways to accomplish what you're trying to do, like unique constraints for example.


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.