A bean primary key field may not be null after ejbCreate has bee

Discussions

EJB design: A bean primary key field may not be null after ejbCreate has bee

  1. hello freinds,

    i want to just reteive a records from database with entity bean (BMP) i.e at the same time i don't want to insert a record in database. i has written a business method which retrieves the records from database and done the empty implementations for ejbcreate and ejbfindbyprimarykey methods as they are must i had written them . now it is deployed and when i run the client it gives the error as:

    javax.ejb.CreateException: A bean primary key field may not be null after ejbCreate has been called

    then what is the way i have to solve for problem when i want to just retreive the records from database with entity but not from session.

    with regards
    k.ramakrishna
  2. Hi!
    how are u getting the remote object reference to call your business method. U can either create it or call a finder method.In your case u may call findByPrimaryKey to get the reference and in ejbFindByPrimaryKey return your primary key(it is a must). else container will not be able to associate an EJBObject with your instance and throw an error.

    hope i'm clear!
    --RG
  3. hello rajit,

    the retieving query is based on two tables with primary key fields as -
    category_id in category
    category_id and subcategory_id in subcategory

    can you please tell me in this case how to write the primary key class.

    with regards
    k.ramakrishna