-->
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: Using/avoiding SELECT..FOR UPDATE on a per-transaction basis
PostPosted: Fri Jan 25, 2008 2:11 am 
Newbie

Joined: Fri Jan 25, 2008 1:53 am
Posts: 1
I have a general "how to approach this" question about a particular use of hibernate.

I'm working on a web-application with Hibernate and seeing a lot of lock contention, which is causing both performance problems and occasional deadlocks. Part of the problem (the part that I'd like help on) is that Hibernate is always using SELECT...FOR UPDATE, which holds certain kinds of lock in PostgreSQL. It happens that the our application maintains a clear separation between operations which modify the database, and operations which do not. This makes the use of SELECT...FOR UPDATE for the [far] more frequent "change nothing" operations, and the resulting lock contention, particularly inconvenient.

What I'd like to do is:

- have operations which do modify objects continue to use SELECT...FOR UPDATE

- have operations which do not modify objects just use a plain SELECT.

I'm not looking to depend upon Hibernate to determine which case is which; I'll tell it; I'm interested in knowing how to tell it, if this is in fact possible.

It seems that one, rather crude, way of doing this is with a second level cache, but this works per-class, not per-transaction. I do want to be able to operate on the same types (indeed the same instances/rows) from the same application, but have some transactions use SELECT and some use SELECT...FOR UPDATE.

Is this possible?

[b]Hibernate version: 3.2.4[/b]

[b]Name and version of the database you are using: PostgreSQL 7.4.7[/b]


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.