-->
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: Records of mysql getting locked after exception in update
PostPosted: Wed Jun 08, 2011 9:23 am 
Newbie

Joined: Wed Jun 08, 2011 6:08 am
Posts: 4
Hi,
I am using J2ee application. I need to perform update on mysql using update method.
I am using version number as part of concurrency control.

Steps
i login to application
2 select a record to update -- > takes me to a new update page
3 click update button
result is my record gets updated

But when
1 I login using IE and Mozilla
2. select same record to update in both browsers
3. Now comes the funny part I click on update button of Mozilla.
4. My record gets updated
5. I click update button of my IF
6. It throws Exception saying org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction
7. I restart my IE browser do the same process as described above and select the same record to update
8. Click on update

My database table gets locked. I dont know why it is behavnig this way.
I am not able to fire any query later not even in Mysql
below is my code

Transaction tx = session.beginTransaction();
session.clear();
try{
session.update(command);
tx.commit();
}catch(Exception e){
tx.rollback();
e.printStackTrace();
System.out.print("loclk mode is "+session.getCurrentLockMode(command));
}finally{
session.flush();
session.clear();
session.close();

}

Any help will be highly appreciated

Thanks in Advance


Top
 Profile  
 
 Post subject: Re: Records of mysql getting locked after exception in update
PostPosted: Thu Jun 09, 2011 1:29 am 
Newbie

Joined: Wed Jun 08, 2011 6:08 am
Posts: 4
no 1 to to take me out of this abyss....


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.