If you look at the EJB 1.1 specs 9.1.4 entity instance life cycle diagram, a
business method on an entity bean can only be called after the instance is
in READY state. The instance is put in the ready state ONLY AFTER the
ejbPostCreate call is complete. Thus as per this diagram, it is not correct
to call a business method on the bean before the bean's ejbPostCreate has
completed.
This is a sort of a grey area since the spec itself does not explicitly
state whether it is legal or not to call a business method before the
ejbPostCreate has finished, but atleast the instance life cycle diagram
would imply this. It is best to use ejbPostCreate to only pass the remote
reference to other beans and not to invoke business methods on these remote
references before ejbPostCreate has completed
An EJB container can probably handle the problem described here but again
since the spec does not indicate anything explicitly for this case, I
suspect different container will exhibit different behavior.
- Saurabh
----- Original Message -----
From: "Richard S.Martin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 15, 2002 8:25 PM
Subject: Re: ejbLoad called on modified entity
> Dear Fname,
>
> The behaviour you describe is definatly not right simply because
the
> modification to bean A never get a chance to get persisted before getting
> clobbered.
>
> I'm guessing what is happening is that the App Server doesn't
recognize that
> it has an instance ready before the postCreate has finished, so it readys
one
> with with ejbLoad.
>
> Is it by any chance JRun you are using? I have seen a similar (but
not quite
> the same) wierdness with JRun calling ejbLoad when it shouldn't be. In the
> end we had to move to another App Server (for that, and a few other
reasons).
>
> Rich Martin
>
>
> On Sunday 14 April 2002 13:40 pm, you wrote:
> > Yes, I'm already implementing the workaround you're
> > suggesting. My question was more with regard to
> > whether other servers were doing this and whether this
> > issue is addressed in the specification.
> >
> > --- Tony Michael <[EMAIL PROTECTED]> wrote:
> > > What about making a flag in the EJB like below ??
> > > -----------------------------
> > > boolean check = true;
> > >
> > > ... ejbLoad(){
> > > if(check){
> > > // Do something for loading
> > > }else{
> > > // Don't load
> > > }
> > > }
> > >
> > > ...( ){
> > > ...
> > > check = false;
> > > ...
> > > }
> > >
> > > -----------------------------
> > >
> > > Of course, It's not that easy like above, but I
> > > guess you can modify it to
> > > work with your EJB.
> > > You really have to be careful with that kinda flag.
> > > Otherwise, your EJB
> > > never load...
> > >
> > > tony
> >
> >
==========================================================================T
> >o
> >
> > > unsubscribe, send email to [EMAIL PROTECTED] and
> > > include in the body
> > > of the message "signoff EJB-INTEREST". For general
> > > help, send email to
> > > [EMAIL PROTECTED] and include in the body of the
> > > message "help".
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://taxes.yahoo.com/
> >
> >
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff EJB-INTEREST". For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
>
>
============================================================================
==
> This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
All information is the view of the individual and not necessarily the
company. If you are not the intended recipient you are hereby notified that
any dissemination, distribution, or copying of this communication and its
attachments is strictly prohibited. If you have received this email in error
please notify:
> [EMAIL PROTECTED]
>
>
>
============================================================================
==
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".