• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction Management Query

 
Gaurav Jain
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In our architecture the stateless session bean calls the service (POJO) which in turn calls the DAO which does the DB operation.Taking the classic debit/credit example how should the transaction management be controlled if either of the debit or credit operation fails? We are using stored procedure instead of direct SQL's.To clarify further we want to rollbackt the entire process of debit if credit fails and vice versa.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the actual need of requirement.Use the container managed transaction. Since you are using stored procedure, make sure that their is no rolback or commit inside stored procedure.
It also depeneds on the code of stored procedure that in what way stored procedure is handling exception and failure.
If your stored procedure returns some custom error code then you need to handle that and in such cases User transaction would do the task better.
you are the one who can better decide what suits to your environment


Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic