Benjamin,
I think the key point here is that ejbLoad is only required to be called before
a business method is invoked. findByPrimaryKey is not a business method. While
some servers may call ejbLoad whenever a bean is activated, there is not need.
It's only needed when "whenever it becomes necessary for the instance to
synchronize its state from its state in the database." A finder only returns an
bean reference so there is no need to sync the state with the database until
some other method has been invoked.
--Victor
Benjamin Broll wrote:
> Hia,
>
> I've got a question related to the Container's view of the Entity Bean
> Component Contract as specified in the EJB Spec 1.1.
>
> Especially I'm concerned with the calling of the ejbLoad() method as
> specified in the spec and as it is implemented in the J2EE Reference
> Implementation.
>
> Since I bought the book Enterprise JavaBeanse 2nd Edition I trusted in the
> statements of the author but I have found one to be too general. In my case
> I execute a findByPrimaryKey() method on the home interface of a BMP entity
> bean. As it is said on page 214, transitioning from the pooled state to the
> ready state via a find method is in fact like the transitioning via
> activation. Now th author states on page 215 that when a BMP entity bean
> transitions from the pooled state to the ready state via activation, at
> first the method ejbActivate() and then the method ejbLoad() is called by
> the container.
>
> But at least for one container this is not true - the container of the J2EE
> RI (so that's why I'm a bit confused right now :). As debugging revealed,
> the container does only call the ejbActivate() method without calling the
> ejbLoad() method afterwards. Although I can simply call the ejbLoad() method
> in the ejbActivate() method the container's behaviour does not seem to be in
> line with the spec.
>
> The spec (9.1.5.2 - public void ejbLoad();) says that the container must
> invoke the ejbLoad() method whenever it becomes necessary for the instance
> to synchronize its state from its state in the database. And since the first
> call of a business method seems to me as the perfect reason to synchronize
> the state of an entity bean (and thus I think Monson-Haefel is right with
> the assertion in his book), the container of the J2EE RI should call the
> ejbLoad() method.
>
> What do you say? Am I the only person (ie. do I have the only computer :)
> where this happens?
>
> Regards,
>
> .bbr
>
> <environment>
> - J2EE 1.2.1
> - Cloudscape Developer Edition 3.5
> - a BMP entity bean
> - a client calling a find method on the entity bean
> </environment>
>
> ===========================================================================
> 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".