Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

transaction handling in ejb2.0

 
jonny jinny
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
We have a 2 entity beans vendor and vendor details.
We are inserting records in vendor and vendor details table via session bean, which in turn calls vendor and vendor detail entity . vendor calls vendor detail using cmr fields.
The problem is with transaction handling. we wish to restrict tht if record is inserted in vendor than only it should be inserted in details, if some err while inserting in detail table , the whole process should be rolled back. Its like all or none case.
How do we implement it, kindly suggest.
Thanks
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would highly recommend you to read the Mastering EJB 2.0 book by Ed Roman. You can download it for free at www.middleware-company.com. Have a look at chapter 10, transactions. and check flat transactions and nested transactions. It's a good starting point to learn this...
hope it helps..
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll agree that you need to read a book on EJBs. This is a basic part of EJB design -- ALL transactions of this type are all-or-nothing. If you use container-managed transactions and set the Session bean to be either REQUIRED or REQUIRESNEW then this happens automatically. Is this not what you're seeing?

Kyle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic