Hi,
I am developing small
EJB CMP2.0 application. Now I have two tables in my database with one-to-one relation. I have Mapped one-to-one relatonship between my EJB's corresponding to those tables using EJB CMR. My contants of ejb-jar.xml & jbosscmp-jdbc.xml for same are as follows:-
ejb-jar.xml
=============================
<relationships >
<ejb-relation >
<ejb-relation-name>empmaster-to-usrmaster</ejb-relation-name>
<ejb-relationship-role> <ejb-relationship-role-name>empmaster-has-one-usrmaster</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<cascade-delete/>
<relationship-role-source >
<ejb-name>EmployeeMaster</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>userMaster</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>usrmaster-has-one-empmaster</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<cascade-delete/>
<relationship-role-source >
<ejb-name>UserMaster</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>employee</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
</relationships>
=============================
jbosscmp-jdbc.xml
=============================
<relationships>
<ejb-relation>
<ejb-relation-name>empmaster-to-usrmaster</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>empmaster-has-one-usrmaster</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>employeebeanid</field-name>
<column-name>userid</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>usrmaster-has-one-empmaster</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>userbeanid</field-name>
<column-name>employeeid</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
</relationships>
=============================
All the things working fine.
Now Problem is that how to perform rollback if some problem will occur in inserting record in second bean after record is inserted in first bean. Currently I am using session bean for calling 'create' method on both the beans in realationship. So how to perform rollback in case of failure??
Please tell me.
Thanx
Prash