geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Efren Gonzalez <gonz...@tutopia.com>
Subject Re: EJB 2.1 CMR Question
Date Tue, 04 Sep 2007 03:23:46 GMT
Hello

You can set the relational fields on the ejbPostCreate() method.

Say that you are inserting a State, and your state table has an 
idCountry Field, you can do:

ejbCreate(Country country, String stateName) {
   // setCountry(country); <- DO NOT SET IT HERE
   setStateName(stateName);
}

ejbPostCreate(Country country, String stateName) {
   setCountry(country); <- SET IT HERE INSTEAD
}

I hope I'm being clear. Let me know if you need a more detailed example.

- Efrén

Mark Aufdencamp escribió:
> Added the <enforce-foreign-key-constraints/> to the openejb-jar.xml
> Changed the Table FK Column back to a NOT NULL Constraint
> Redeployed the application
> 
> Throws a SQLException (Column 'ColumnName' cannot be null) on the INSERT
> SQL Statement when the EJBCreate is executed
> 
> Anyone else have an idea on how to influence the EJBCreate/EJBPostCreate
> Transaction?
> 
>> -------- Original Message --------
>> Subject: Re: EJB 2.1 CMR Question
>> From: "David Carew" <dccarew@gmail.com>
>> Date: Sat, September 01, 2007 7:41 pm
>> To: user@geronimo.apache.org
>>
>> 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
>>> Mark@Aufdencamp.com
>>>
>>> BTW - I'm pretty close to migrating to Geronimo 2.0 (a couple of
>>> iterations).  How does this same scenario work out with JPA?
>>>
>>>
>>>
>>>
> 
> 
> 
> 

Mime
View raw message