I can think of two reasons why the no-args constructor requirement exists:
1. When an EJB container object needs to activate a bean that uses BMP,
it first must construct a default instance, then call ejbLoad() on the
bean. For CMP, the activation process is a little different, but still
requires a default instance of the bean, that the container's CMP code
initializes using the reflection API.
2. Under BMP, several of the home interface support methods (like findBy)
reside in the bean implementation class. As a result, the container object
that implements the home interface must instantiate a dummy instance in
order to call these methods.
There probably are several other places where the default ctor is used, but
these two alone seem pretty compelling.
Charlie
> -----Original Message-----
> From: Daniel Bradby [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 30, 2000 11:56 PM
> Subject: Spec Clarification: constructors in EJBs
>
>
> I was cleaning up some EJB code and browsing through the bean providers
> responsibilities in the EJB spec (as one does) and noticed that the spec
> requires a session bean (6.10.2) and an entity bean (9.2.2) to " ....
> have a public constructor that takes no parameters."
>
> I noticed the only examples I could find that actually did this was
> Sun's, and they only do it in the session beans.
>
> Anyone throw any light on this strange requirement? And why no one
> actually does it?
>
> Thanks
>
> ---
> Daniel Bradby
> BJS Australia
> [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".