Create a CMP Bean

Discussions

EJB design: Create a CMP Bean

  1. Create a CMP Bean (1 messages)

    I have create a CMP Bean, I have a "ejbCreate" method with some parameters on the Bean :

    public class Share extends EntityBean {
     public String name;
     public Object ejbCreate(String aName) {
      name = aName;
     }
    }

    and I think that the home interface should not have and ejbCreate method !

    public interface ShareHome extends EJBHome {
     public Share findByPrimaryKey(Object pk) throws ...
    }

    How can I create a new instance of a share bean from the home, I have no creation method !! Do I need to add one ? and how, I have no PK !

    Can someone explain me how to do this ! Thanks

    Threaded Messages (1)

  2. Create a CMP Bean[ Go to top ]

    Hi, Christophe,

    In the interface home you must have a method create and in the Bean, a method ejbCreate. The method create in the home corresponds to the method ejbCreate in the Bean; both must have the same parameters.

    About the primary key, if the primary key is only one field, you don't need to create a class - though you can do it if you want -, but if the primary key is compose by two or more fields, you must create a Primary Key class.

    Regards,

    Poli