> -----Original Message-----
> From: Shiv Kumar [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 21, 2000 10:33
> To: [EMAIL PROTECTED]
> Subject: ejbCreate() prototype
>
>
> Section 9.4.2 of EJB 1.1 spec (Entity beans with CMP) :
>
>      The ejbCreate(...) methods must be defined to return the
> primary key
>      class type. The implementation of the ejbCreate(...)
> methods should be
>      coded to return a null. The returned value is ignored by the
>      Container.
>
> My question : If the container ignores the return value, why
> does the method
> prototype require a return type?
>
This allows the container to implement CMP as a BMP entity, by subclassing
the bean implementation:

class MyEntityBeanImpl extends MyEntityBean {

    public MyPK ejbCreate(...) {
        super.ejbCreate(...);
        conn = getConnection();
        // ...
        stmt.executeUpdate("insert into my_table values ( .... ) ...");
        //...
        return new MyPK(...); // BMP mandated return
    }
}

- Avi
--
s/\be(\w+)/e-\1/g;

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