-->
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.  [ 2 posts ] 
Author Message
 Post subject: DeadLock occurs in a Select statement
PostPosted: Wed Mar 23, 2005 6:55 am 
Beginner
Beginner

Joined: Thu Jan 22, 2004 6:16 am
Posts: 40
Location: Luxembourg
This problem only occurs on a MSSQL database. When I am doing a Select query, the table which that is done on is being locked.

So when another process tries to query it, a deadlock occurs after a time giving this error : java.sql.SQLException: Transaction (Process ID 55) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

A solution would to add a NOLOCK when doing the Select query as follows (just an example):
SELECT COUNT(field1) FROM Users WITH (NOLOCK) WHERE field1 LIKE 'HELLO'=20=20

Can this be achieved with Hibernate in some way ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 23, 2005 7:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use native sql queries ?

but is mssql really locking down the whole table because someone else is reading/selecting from it ?

Is it not cause by someone writing to it at the same time and that process is holding the lock too long ?

_________________
Max
Don't forget to rate


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