Null Pointer Exception while calling create() in entity bean

Discussions

EJB programming & troubleshooting: Null Pointer Exception while calling create() in entity bean

  1. Hi,
    When I am calling the create(param1,param2,...)
    method null pointer exception comes.I give print
    statements in ejbCreate(param1,param2,...) method
    and all those statements get printed and after that
    its shows the error :null pointer exception from
    ejbCreate().

    Thanx in advance...

    Deepesh
  2. What type of persistence are you using?
    This is just a shot in the dark, but:
    - If you're using BMP make sure you return a PK
    - If you're using CMP make sure you update the PK fields before returning.

    If these fail I might have other ideas if you post a code snippet+info. This way I'm only guessing...

    regards
    Gal
  3. Hi,
    I am using CMP.
    Following is the code which I am using-->

    dataImplantRequisitionDetailHome.create(param1,param2,....);
    I have given the print statements in
    ejbCreate(param1,param2,....) which prints the value of
    various parameters passed to the create().
    After printing the values and before calling ejbPostCreate()
    it gives null pointer exception.

    Waiting for quick reply....
    Thanks and regards,

    Deepesh
  4. I ment the code of your ejbCreate method... I can't make any new ideas with the info you just gave me...

    Regards
    Gal
  5. Hi,

    If this is an entity bean you should return the Primary Key. What could be happening is that you return a null object.

    Joost.