Hi,
I have 3 EJB, 1 session and 2 entities (IdBranch and IdSBranch) ones. I
have a client application witch performs a call to the session bean. The
session bean inserts data with IdBranch to branch�s table and with IdSBranch
to another sub_branch�s table.
Transaction 1 is OK, but transaction 2 is not OK so transaction 1 & 2 have
to be rollbacked. Unfortunatelly, it is not the case.
So� what attribute do I have to use in the descriptor?????
Thanks
JMi
Code in the IdSessionBean:
�
//******************************************
// INSERTION
//******************************************
Object refBran = jndiContext.lookup("IdBranch");
Object refSBran = jndiContext.lookup("IdSBranch");
IdBranchHome branchHome = (IdBranchHome) PortableRemoteObject.narrow
(refBran, IdBranchHome.class);
IdSBranchHome sBranchHome = (IdSBranchHome) PortableRemoteObject.narrow
(refSBran, IdSBranchHome.class);
//Insert data into 2 tables
IdBranch branch = null;
IdSBranch sBranch = null;
try {
branch = branchHome.create("534", 4, "test", 500);//Transaction 1
int fkBran = ((IdBranchData)branch.getData()).m_ID_BRAN;
sBranch = sBranchHome.create("534", fkBran, 4, param, 500);//Transaction2
- param generates the error while inserting
} catch(Exception e) {
System.out.println("== ERROR: " + e.getMessage());
}
�
And the ejb-jar.xml part:
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>IdSessionBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>IdBranchBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>IdSBranchBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]