This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 3879
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: transaction handling in ejb2.0
 
Similar Threads
Transactions Questions
Transaction Attribute setting in CMP
Transaction Attributes in EJB
Transaction handling in stateless session bean.
Basic Design Ques - Which EJB Type to use?