• Post Reply Bookmark Topic Watch Topic
  • New Topic

help! the invoke of findByPrimaryKey() always throws ObjectNotFoundException

 
Robert Strong
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use CMP Entity Bean, and I succeeded in writing query using EJB-QL. But the method of FindByPrimaryKey() is implemented by the container itself. Every time I call this method, it always throw ObjectNotFoundException, while the corresponding record surely exists in database.
anyone could help me?
thanks in advance
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"play",
Thanks for joining JavaRanch, but we have a naming policy that everybody must adhere to. Please take a quick look at this and edit your profile accordingly.
Thanks!
Simon
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, as for your question, are you using a specific class for your primary key (other than, e.g. Integer, String, etc)? If so, check that the equals and hashcode methods are implemented properly.
Otherwise, double check that the data is indeed in the database that the entity bean is accessing.
Cheers
Simon
 
Robert Strong
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both primary key wrapper class and String type throws ObjectNotFoundException
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!