Hi,

Relationships cannot be defined in ejbCreate and should be defined in the corresponding ejbPostCreate. The spec says (p. 188):
"
The entity Bean Provider must not attempt to modify the values of cmr-fields in an ejbCreate<METHOD> method. This should be done in the ejbPostCreate<METHOD> method instead.
"
Thanks,
Gianny


On 15/10/2005 3:05 AM, Aaron Mulder wrote:

So I've noticed that if I call a setter related to a CMR in ejbCreate,
it blows up:

Caused by: java.lang.IllegalStateException: Identity not available
       at org.tranql.cache.CacheRow.getId(CacheRow.java:163)
       at org.tranql.ejb.OneToManyCMR.set(OneToManyCMR.java:49)
...

The rest is slightly different depending on whether it's a CMR setter
or a CMP setter that happens to be for the foreign key of the CMR.

Anyway, calling the same thing in ejbPostCreate works fine.

(My scenario is, I have tables like Parent(ID) and child(ID, PARENT_ID
not null) so I have to set the parent_id on the child during the
creation process.)

Does the spec say something about not setting CMR fields in ejbCreate
and so I'm trying to do something wrong?  Or should we support that?

Thanks,
   Aaron





Reply via email to