-----Original Message-----
From: Alex Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 8:25 PM
To: Chad Brandon
Subject: Re[4]: [JBoss-user] CMP Entity Bean Insert/Commit after
ejbPostCreate()


Thursday, March 13, 2003, 9:47:38 PM, you wrote:
CB> Hi Alex,
CB> I'd really like to know how to do this.

First, if foreign key fields and primary key fields to the same
columns in the database.
Suppose, you create a Child entity when related Parent doesn't exist
yet. Child is created and getParent() returns null (as there is no
Parent yet)
Later you create Parent for the created above Child. Relationship
between Parent and Child is establisged automatically after ejbCreate
and before ejbPostCreate (so in ejbPostCreate it is ready).
Relationship is established only if Parent's pk columns have the same
values as Child's primary key columns to which Parent's foreign key
fields are mapped.

Established relationship is destroyed only when Child or Parent is
deleted.

Attempts to change relationships with CMR setters results in
exceptions as it is not allowed to change entity's primary key.

It is also possible to have foreign key fields partly mapped to
primary key columns and partly to its own columns. In this case you
can manipulate relationships with CMR setters only if the don't affect
primary key columns. Foreign key field is considered NULL if at least
one column that is not a primary key one contains NULL value.

It could be still hard to grasp. If you have a real problem then
describe it and we'll follow a real example.

alex

CB> Thanks,

CB> Chad
CB>  Alex Loubyansky <[EMAIL PROTECTED]> wrote:DS> 3.2 supports not null
foreign keys, but you will have to ask Alexey how
DS>> to set it up.

CB> Just map foreign key fields to primary key columns.

CB> This case is not trivial and we had hot debates on this topic with
CB> Dain and Jeremy. If foreign key fields mapped to primary key fields is
CB> what you need then feel free to ask for details on how it works.

CB> Just FYI, you can also have a partial mapping, i.e. some of the foreign
key
CB> fields are mapped to primary key columns and others to its own. But
CB> those that mapped to its own can't be NON NULL.

CB> alex

DS>> -dain

DS>> On Thursday, March 13, 2003, at 10:42 AM, Jonathan.O'[EMAIL PROTECTED] 
DS>> wrote:

>>>
>>> Bernhard,
>>> No, JBoss 3.x does the insert after ejbCreate. 4.0 is reputed to have 
>>> (will have) support for INSERT after ejbPostCreate.
>>>
>>> Ciao,
>>> Jonathan O'Connor
>>> Development Manager
>>> XCOM Dublin
>>> Phone: +353 1 872 3305
>>> Mobile: +353 86 824 0736
>>>
>>>
DS>> 
>>>
>>>
>>>
>>>
>>> Hi,
>>>
>>> does JBoss 3.2 issue INSERT/COMMIT after ejbPostCreate() or is it 
>>> possible
>>> to configure it this way (you can do this e.g. in WebLogic) ?
>>>
>>> As far as I know, all JBoss 3.0.x versions already do an INSERT between
>>> ejbCreate() and ejbPostCreate(). Has this changed in any newer 
>>> version()?
>>> This is a problem for me, since this means FK columns can't be 
>>> declared as
>>> NOT NULL since as y'all know CMR fields can only be set in 
>>> ejbPostCreate().
>>> I don't want to use Deferred Constraints feature some databases offer.
>>>
>>>
>>> Cheers,
>>> Bernhard
>>>
>>>
>>> Bernhard Meyer-Willner, MSc
>>> Insurance - Financial Services
>>> _________________________________________
>>>
>>> LogicaCMG
>>> Logica GmbH
>>> Osterbekstrasse 90b - Alster City
>>> 22083 Hamburg
>>> Germany
>>> T:  +49 (0) 40 27071-405 (direct)
>>> M: +49 (0) 177 425-9036
>>> E:  mailto:[EMAIL PROTECTED]
>>> www.logicacmg.com



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to