aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Transaction Attribute setting in CMP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Transaction Attribute setting in CMP" Watch "Transaction Attribute setting in CMP" New topic
Author

Transaction Attribute setting in CMP

kapil kulkarni
Greenhorn

Joined: Jan 30, 2001
Posts: 8
I have some doubts regarding setting transaction attributes for
EJB in deployment descriptor.
I explain the situation :
A session beans calls for inserting a new record in a table say X
table.
Method name is insertRow(some params);
This method is having transaction attribute as "requires". Now this method
calls 2 entity beans to insert new records. i.e. first new record is created
with "create" method of X entity bean. It's transaction attribute is
"requires". X table is master table. Now after this some data is
inserted into child table X_CHILD with X_ID as foreign key
(X_ID is primary key in X).
Now "create" method of XChild entity bean is used for this insertion
and its transaction attribute is "requires".
But if this method insertRow(..) of session bean gets executed, we are
getting exception as "parent key not found" while inserting records in
X_CHILD after inserting new record in X.
What should we do in this case ?
If we change transaction attribute of "create" method of X entity bean
to "requires new", we are not getting exception. But if there is some
exception while inserting row in X_CHILD and we get exception then
transaction gets rolled back but as transaction newly started for X entity beans
"create" method is commited it does not get rolled back ?
What should we do in this case ?
Thanks in advance for your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transaction Attribute setting in CMP
 
Similar Threads
transaction handling in ejb2.0
Some doubts with transactions(Please help).
Transaction attributes
Transaction Attributes in EJB
My SCEA Part 1Study Notes