But surely - someObject will be initialised because when the EJB container
creates an instance of OrderTask, it's default constructor - OrderTask()
will be called - and this will be done PRIOR to a call to ejbCreate().

Is this true ?

-----Original Message-----
From: Hermann Schmitt [mailto:[EMAIL PROTECTED]]
Sent: 19 October 1999 16:48
To: [EMAIL PROTECTED]
Subject: AW: Default class constructor verses ejbCreate() on SessionBean


Hallo,
I think, that makes no sense.
ejbCreate is called by the home and according to your program calls startup
which does something with someObject.
But someobject is not yet created.
Hermann Schmitt
-----Urspr�ngliche Nachricht-----
Von: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]Im Auftrag von Rumble, Nick
Gesendet: Dienstag, 19. Oktober 1999 16:28
An: [EMAIL PROTECTED]
Betreff: Default class constructor verses ejbCreate() on SessionBean
Wichtigkeit: Hoch


Hi - I've a question about the legality of using a class's default
constructor to perform some initialisation. This is best explained by
example. I have an abstract Session Bean called "Adaptor" it's main task is
to call the "startup" method within subclassed "real" Session Beans:

public abstract class Adaptor implements SessionBean
{

        public void ejbCreate()
                throws RemoteException
        {
                startup();
        }

        // Rest of SessionBean and Remote interfaces cut out for brevity

        protected abstract void startup() ;
}

Example "real" session bean that can be instantiated by an EJB client:

public class OrderTask extends Adaptor
{
        Object  someObject;

        public OrderTask()
        {
                someObject = new ..... ;
        }

        protected void startup()
        {
                someObject.doSomething();
        }
}


In this example, the default constructor for OrderTask() initialises/creates
someObject and the startup() method - called indirectly by the default EJB
constructor - "ejbCreate()" does something with it.

Is this acceptable/legal ?

Thanks in advance.

Nick Rumble








The statements and opinions expressed here are my own and may not represent
those of the company.

This e-mail is subject to copyright and the information in it is
confidential. It is intended only for the named recipient. You are advised
not to disclose the contents of this e-mail to another pers
on or take copies of it.

===========================================================================
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".








The statements and opinions expressed here are my own and may not represent those of 
the company.

This e-mail is subject to copyright and the information in it is confidential. It is 
intended only for the named recipient. You are advised not to disclose the contents of 
this e-mail to another pers
on or take copies of it.

===========================================================================
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