This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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
Author

transaction handling in ejb2.0

jonny jinny
Greenhorn

Joined: Oct 29, 2002
Posts: 11
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

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 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..


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

Joined: Aug 10, 2001
Posts: 3892
    
    5
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


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
 
subject: transaction handling in ejb2.0