Hi there,
when I'm creating an Entity Bean inside the ejbPostCreate of another Entity Bean, how do I tell the application server that these two creation steps are part of one transaction, i.e. the creation of the Bean the ejbPostCreate belongs to has to be rolled back if the creation of the second bean fails?
Thanks...
-
Cascaded creation of Entity Beans (2 messages)
- Posted by: Cameron Yast
- Posted on: December 06 2002 08:45 EST
Threaded Messages (2)
- Cascaded creation of Entity Beans by Eric Morin on December 06 2002 15:15 EST
- Cascaded creation of Entity Beans by Alvaro Goncalves on December 07 2002 07:33 EST
-
Cascaded creation of Entity Beans[ Go to top ]
- Posted by: Eric Morin
- Posted on: December 06 2002 15:15 EST
- in response to Cameron Yast
Have a session facade with "new transaction" call your entity beans with "transaction required". Both create will occur in the same transaction... -
Cascaded creation of Entity Beans[ Go to top ]
- Posted by: Alvaro Goncalves
- Posted on: December 07 2002 07:33 EST
- in response to Eric Morin
Hi
<one-transaction>
Session Facade (Required) --> Entity 1 (Mandatory)
Entity 2 (Mandatory)
</one-transaction>
Problem with constraint in database.
The WebLogic 7.0 app server´s dbms configuration descriptor has a tag
<delay-database-insert-until> which defines the stage in an entity bean´s
create process in which the bean is persisted in the database.
The allowed values are: ejbPostCreate(default), ejbCreate and commit
This is useful when we need to create a child entity from inside the
ejbPostCreate method of a parent entity. The foreign-key field on the
child´s table will try to match an existing key on the parent, but since it
has not been persisted, a violation error will occur. To avoid that, and
still use the foreign-key constraint in the child´s table, we use the
"ejbCreate" or "commit" value on the tag in the parent bean´s descriptor.
In JBOSS, for example this is not possible.
Alvaro Mota Goncalves