Thursday, August 2, 2012

Exception:
javax.ejb.ObjectNotFoundException: No such entity!

Scenario:

findByPrimaryKey() method called on an EJB entity bean.
Not able to find a record with the provided key/id.
 
Solution:

There are two cases here : 
  1. There is something wrong in the code, probably querying a wrong EJB to retrieve information, resulting in the exception.
  2. Probably you want to catch the exception and do something meaningful, when there is no record with the given key/id.


 

No comments:

Post a Comment