Sur WebLogic, tu dois utiliser delay-database-insert-until (c'est aussi un sujet qui a ete enormement discute sur nos newsgroups). Voici ce que dit la documentation : Utilise ejbPostCreate() pour faire ca.
[Sebastien LAYER] --> c à d. Ceci n'empeche nullement l'utilisation de Setter sur la clé étrangère, et vu que cette clé est non null (contrainte) dans la base, le create ne peut se derouler correctement.
<!--
The delay-database-insert-until element is used to specify the
precise time at which a new bean that uses RDBMS CMP is inserted into
the database. By default, the database insert is done after
ejbPostCreate.
Delaying the database insert until after ejbPostCreate is required
when a cmr-field is mapped to a foreign-key column that doesn't allow
null values. In this case, the cmr-field must be set to a non-null
value in ejbPostCreate before the bean is inserted into the database.
Note that cmr-fields may not be set during ejbCreate, before the
primary key of the bean is known.
It is also generally advisable to delay the database insert until
after ejbPostCreate if the ejbPostCreate method modifies the
persistent fields of the bean. This can yield better performance by
avoiding an unnecessary store operation.
For maximum flexibility, developers should avoid creating related
beans in their ejbPostCreate method. This may make delaying the
database insert impossible if database constraints prevent related
beans from referring to a bean that has not yet been created.
Allowed values:
ejbCreate - perform database insert immediately after ejbCreate
ejbPostCreate - perform insert immediately after ejbPostCreate
commit - perform bulk insert at transaction commit
Default: ejbPostCreate
Used in: weblogic-rdbms-bean
Since: WLS 6.0 SP1, 'commit' option added in WLS 7.0
Example:
<delay-database-insert-until>
ejbPostCreate
</delay-database-insert-until>
-->
<!ELEMENT delay-database-insert-until (#PCDATA)>
-- Cédric http://beust.com/weblog
