Thanks Ian, and all who replied. Your answers have made things a whole lot clearer.

Very much appreciated

Cheers

DJ

Ian McCallion wrote:

> Dane Jones wrote:
> >
> > Thanks Dion for your quick response.
> >
> > However your answer is actually the very cause of my confusion.
> >
> > As far as I can tell, the ejbFind*() methods are called after the
> > ejbCreate() is invoked. Is that correct? In that case, if cust
> > already exists (I don't mean _cust_ per se, but the table row that will be
> > used to fill the EJB's attributes) what's the point of an
> > INSERT statement within ejbCreate() when it's already there and the
> > ejbFind*() method can retrieve the existing record?
> >
> > Does the ejbCreate() method *have* to contain an INSERT statement (for BMP)?
> > And does the ejbRemove() method have
> > to contain a DELETE statement?
> >
> > I know I'm missing something quite logical, and this is making me feel quite
> > stupid.
>
> Dane,
>
> Perhaps the point you are missing is that the Bean Instance is considered to
> exist whenever there is a database record that corresponds to the PK of the
> bean. It is even considerd to exist while the EJB server is down or the database
> is offline.  Since the purpose of ejbCreate() is to create Bean Instances, when
> the database is populated by a non-EJB application ejbCreate is never called.
>
> Bean Instances should not be confused with the three other types of "instance".
> First, the "Object Instance" is an instance of the Java class that has the
> bean's methods on it. Object Instances are created and destroyed by the server.
> A simplistic server would create an Object Instance when a Bean Instance was
> loaded into memory and would destroy the Object Instance at the end of the
> transaction that created the Object Instance. In practice, the server creates
> pools of such instances and allocates them to Bean Instances as necessary.
>
> Second, the "Proxy Instance" which is an object that exists in the client and is
> operated upon by the client and lasts as long as the client needs it.
>
> Finally there is the " EJBOBject Instance" which is what the Proxy Instance is a
> proxy to. I mention it only because it is discussed in the EJB spec - it is
> quite irrelevant to the EJB developer. Servers may create these (or they may
> not). If used by the server they probably exist while the "Proxy Instance"
> exists.
>
> To summarise:
>
> - Bean Instances last as long as the application needs the data
> - Object Instances last as long as the server needs them
> - Proxy Instances last as long as the client needs them
> - EJBObject Instances may or may not exist at all
>
> Hope this helps...
>
> cheers... Ian
>
> Ian McCallion
> Alexis Systems Limited
> Romsey, UK
>
> ===========================================================================
> 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".

Reply via email to