-->
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.  [ 9 posts ] 
Author Message
 Post subject: select queries and transactions
PostPosted: Tue Sep 06, 2005 3:35 am 
Newbie

Joined: Tue Sep 06, 2005 3:26 am
Posts: 4
Hi all,

I'm developing a project with hibernate and oracle and it works fine except for some strange blockings that appear performing select queries.

As far as I know Oracle allows all kind of selects to be performed even when doing update operations on the same rows. It looks like some update operations are blocking even the select queries.

I'm doing all my hibernate operations with the transaction object, I was wondering if this could be the problem I'm getting, maybe I should not use the transaction manager for doing select queries?

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 4:13 am 
Regular
Regular

Joined: Tue Oct 07, 2003 10:20 am
Posts: 77
What transaction isolation level have you set in your Hibernate configuration file?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 4:14 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
See "Using Oracle Lock Manager" in oracle documentation, it must help to find a problem (if this is related to oracle locks).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 4:49 am 
Newbie

Joined: Tue Sep 06, 2005 3:26 am
Posts: 4
I'm using the default configuration for oracle and hibernate, by default oracle uses the READ COMMITED isolation level that should allow any select query even in the case of a row level block at the same time.

In hibernate I'm using the same isolation level, READ COMMITED.

Should I try with READ UNCOMMITED?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 4:58 am 
Regular
Regular

Joined: Tue Oct 07, 2003 10:20 am
Posts: 77
Could you post your hibernate.properties or hibernate.cfg.xml

I must admit that I haven't had any problems with Oracle locking tables on updates, and you appear to have it set at the weakest transactional isolation level.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 5:51 am 
Newbie

Joined: Tue Sep 06, 2005 3:26 am
Posts: 4
Thats my hibernate.properties:

hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'

hibernate.dialect org.hibernate.dialect.Oracle9Dialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.url jdbc:oracle:thin:@//192.168.1.12:1521/shoms
hibernate.connection.username ******
hibernate.connection.password ******

hibernate.query.substitutions yes 'Y', no 'N'

hibernate.connection.pool_size 2
hibernate.statement_cache.size 100

hibernate.show_sql = false
hibernate.cglib.use_reflection_optimizer = false
hibernate.connection.isolation = 2


level 2 is READ_COMMITED.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 6:02 am 
Regular
Regular

Joined: Tue Oct 07, 2003 10:20 am
Posts: 77
Ah I tell a lie, obviously you're not using the weakest transaction isolation level. Do you actually need to use READ_COMMITTED? If not, do you still have the same problems using the weakest level of NONE (or 1).

I found this article very useful for helping me with Oracle locking issues -
http://www.akadia.com/services/ora_locks_survival_guide.html

It may be worth using a tool to actually find out what kind of locks are being issued against your tables - Quest Software's TOAD is very good at showing session states.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 6:06 am 
Regular
Regular

Joined: Tue Oct 07, 2003 10:20 am
Posts: 77
Apologies, too little coffee this morning! The transaction isolation of 1 is READ_UNCOMMITTED, as you stated.

Give that a go if you can and see if it makes any difference.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 6:10 am 
Newbie

Joined: Tue Sep 06, 2005 3:26 am
Posts: 4
Actually, READ UNCOMMITED should be all right for my purposes, so I'll give it a try.

Thanks a lot.


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