Seems pretty straightforward, and it can be done with pure declarative
transaction management.
1) Specify the transaction attribute for both entity beans as "Mandatory";
this requires that the bean be called within the scope of an existing
transaction. Calling the bean outside a transaction context results in an
error. This provides some level of protection against a client inadvertently
fiddling with one or both entities.
2) Specify the transaction attribute for the method on the session bean that
manipulates the two entity beans as "Required", "RequiresNew", or
"Mandatory" -- whatever floats your boat. You want to ensure that a
transaction will be in effect when they're called, so you can't use "Never",
"Supports", or "Not Supported"
The net effect of this is that there's a transaction in effect when you
manipulate your entities; if the transaction fails, all changes will be
undone. At least in theory (some implementations will have trouble handling
this situation if the two entities use different back-end storage
mechanisms; caveat emptor and all that).
===========================================================================
Tom Valesky -- [EMAIL PROTECTED]
http://www.patriot.net/users/tvalesky
-----Original Message-----
From: Leigh, Louis <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, October 13, 1999 1:48 PM
Subject: Help on updating two entity beans persistent different tables wit h
one commit
>Hello,
>
>I am having trouble with an EJB problem. I want to use container managed
>persistence and have two Entity beans, like a person bean and his address
>bean both save to their persistent storage as a unit so the data integrity
>between the two is preserved. Example. I can't have the address inserting
>if the insert of the person failed. I'm assuming there is a way, maybe
like
>having a session bean with remote instances of both. If the session bean
>closes do the two entity beans get saved as a unit and is there a backout
>automatically handled by an application server that will keep the two
>relational tables in sync. Do I need to manage this with the jta or can
>Container managed persistence do it for me.
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff EJB-INTEREST". For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".