File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes transaction handling in ejb2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "transaction handling in ejb2.0" Watch "transaction handling in ejb2.0" New topic

transaction handling in ejb2.0

jonny jinny

Joined: Oct 29, 2002
Posts: 11
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.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
I would highly recommend you to read the Mastering EJB 2.0 book by Ed Roman. You can download it for free at 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..

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
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 Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: transaction handling in ejb2.0
It's not a secret anymore!