Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rollback not working in Hibernate  RSS feed

 
sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

In my code i am doing some updates in group. What i have to do is if during any updation if there is some exception, the previous save should rollback to old data.
This thing is not happening.Eg:- Here I am purposely throwing exception at 4th update to check if the previour 3 updates are rollbacked or not.
They are not rollbacked in DB. My DB is Oracle 10g

Please help




And yes i have added this entry to hibernate.cfg.xml file : <property name="hibernate.connection.autocommit">false</property>
 
sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody please
 
sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Close this thead. This code was running in a while loop which had another transaction processing simultaneously. Had to remove its Transaction.commit

Now the code works as expected
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!