Check out  the  EJB section in Aaron Mulder's book here. http://www.chariotsolutions.com/geronimo/geronimo-1.1/ejb-structure.html#id2594234   There's a element in the EJB deployment plan called <enforce-foreign-key-constraints> that may be applicable to your scenario.


On 9/1/07, Mark Aufdencamp <mark@aufdencamp.com> wrote:
I've done some more homework on my own regarding this one.
 
It appears both JBoss and WebLogic have identified this issue and resolved it by allowing the containers Insert Transaction to be delayed until after the EJB PostCreate method.  This appears to be set in both flavors via a container configuration command.
 
JBoss - <insert-after-ejb-post-create>true</insert-after-ejb-post-create>
WebLogic - <delay-database-insert-until>ejbPostCreate</delay-database-insert-until>
 
How can one configure Geroimo 1.1.1 to engage in similar behavior?


-------- Original Message --------
Subject: EJB 2.1 CMR Question
From: Mark Aufdencamp < mark@aufdencamp.com>
Date: Fri, August 31, 2007 12:14 pm
To: user@geronimo.apache.org

Hi All,
 
I'm working on some CMR EJB's and had a more general question on EJB architecture rather than specifically with Geronimo's implementation.
 
I have a pair of entity beans with a 1:M relationship.  I'm attempting to set the parent object with a CMR,
setParentEntityLocal(ParentEntityLocal parent), on the many object during the creation of the many.  I've tried to do this in the PostCreate and the Create.
 
Problem is the Foreign Key Column on the Child table has a NOT NULL constraint.  How does one typically deal with this?   Is it possible, or do I need to modify the DDL on the database?  Can the FK column be defined as a CMP and set without messing up the CMR field?
 
I have the freedom to change the DDL, but was a bit curious how one would deal with this if they were working in a more structured environment where the DBA might not be so willing to change th DDL.
 
Thanks, as always:)
 
Mark Aufdencamp
 
BTW - I'm pretty close to migrating to Geronimo 2.0 (a couple of iterations).  How does this same scenario work out with JPA?