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
|
|