You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Aaron Mulder <am...@alumni.princeton.edu> on 2005/10/14 19:05:41 UTC

CMR Setters & ejbCreate

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

Re: CMR Setters & ejbCreate

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
Cool.  Perhaps we could try to throw a more meaningful exception in
that case -- your description below was certainly clear enough.  :)

Thanks,
    Aaron

On 10/14/05, Gianny Damour <gi...@optusnet.com.au> wrote:
> 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
> >
> >
> >
> >
> >
>
>
>

Re: CMR Setters & ejbCreate

Posted by Gianny Damour <gi...@optusnet.com.au>.
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
>
>
>
>  
>