access bean for an entity bean with composit key


EJB design: access bean for an entity bean with composit key

  1. Hi all,
          I have an entity bean where in the combination of two field works as a primary key.
    I have written an access bean for the bean using VAJ.
    Now whenever I am trying to use the access bean from my client program I am getting an exception which says the the objected that should be passed to the findByPrimaryKey method is not found.

    However I have tested one more entity bean where, only one field is the primary key and it is working fine.

    Does anybody have any idea, why the client program fails whenever the access bean uses an entity bean with composit key?

    Your response will be appriciated.

  2. Have you written a Primary Key class that properly implements hashcode and equals methods? That Primary Key class should contain these two primary keys as members.
  3. Yes, I have the primary key class and those two methods are also there. I had used VAJ for writting the entity bean and access bean. So every thing has been generated automatically.

    Any idea what could be the problem?

  4. Hi,

    Stupid questions:

    - is the row you are looking for in the db?
    - are you sure that no duplicate rows exist with the same keys?
    - if one field is a date, are you sure that the format is correct?