-->
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: concurrency problem in multithread application
PostPosted: Fri May 20, 2005 1:20 am 
Newbie

Joined: Fri May 20, 2005 12:51 am
Posts: 2
Hi,
I am a newbie to Hibernate here is my problem

1. I created a java utility, which runs 5 threads Simultaneously,
2. Each thread call a synchronized method which thread fetches a Single record whose status is free (for getting the single record based on status of that record. I am opening the session explicitly and starting transaction & creating a Query object then passing the int value in setMaxResults method of query).
3. It returns the list containing that single record, then I change in status of record to busy, to mark that a thread it working on it (for doing this I am using getHibernateTemplate.update method)
4. Then I work with that record.
5. In last I change the status to done to mark that I am finished with the record.

I am facing problem in step 2 and 3
while viewing logs i come to know that once I thread changes the status of the record to busy even then other threads are able to access it and they start processing it again which should not happen.

Any suggestions which can help me to know where I am wrong

Thanks & regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 1:26 am 
Newbie

Joined: Fri May 20, 2005 12:51 am
Posts: 2
I am using hibernate 2.1


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.