Can any one know Compound primary entity bean using weblogic


EJB programming & troubleshooting: Can any one know Compound primary entity bean using weblogic

  1. Can any body specify the location for examples which does use compount primary key in cmp entity bean.
  2. Hi

    You can use compound primary key in Bean Managed Entity beans. for that you have to define these fields in the Primary key class.

    The create method in Home interface must be modified in such a way that it takes all the Primary key field values as parameters. els you have to provide a create method which takes a Primary Key class as the Input.

    For example if CustomerId and DepartmentId is the Primary key of that class then you have to define these two fields in the Primary Field class.

    There ca=n be two versions of the crfeate method as

    create(long customerid, long departmentid) or
    create (BeanPk pk) , where BeanPK is the Primary class for that Container Managed Bean.
    Hope I have answered your querty. If not satified sens a mail to [email protected]
  3. Hi
      U can use compound primary keys in CMPs too...its only that during the deployment u need to specify the primary key in the XML file in a different manner.
      Compound keys are defined in ejb-jar.xml file by specifying only the user defined class.
     Example :


    I hope this solves ur problem