• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How DB Transactions are handled

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider I have two tables , Emp1 and Emp2. In Emp1 i update some data, in Emp2 some exception
occurs means how can i handle transaction. how to roll back. Technologies am using java, struts, hibernate
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Hibernate either by calling rollback directly should an exception occur, or by delegating to whatever the current session is (if you are using CMT/JTA).
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No i am not clear.
Consider I have two tables , Emp1 and Emp2. In Emp1 i update some data, in Emp2 some exception
occurs means how can i handle transaction.
 
Dipendra Dubey
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is advantage of using polymorphism......Even we can write other function
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajendra Prakash wrote:No i am not clear.
Consider I have two tables , Emp1 and Emp2. In Emp1 i update some data, in Emp2 some exception
occurs means how can i handle transaction.


Just roll it back in a catch block. Nothing more to it than that.

Dipendra Dubey wrote:
What is advantage of using polymorphism......Even we can write other function

Not sure I follow this in the context of the current question. Did you mean to post it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic