Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Catching javax.persistence.NoResultException

457351Feb 14 2007 — edited Feb 15 2007
Greetings to all,

I have done a Java Client in order to test my Stateless Facade Bean, but the problem is when i invoke a method for get a named query results, it to throws the exception "javax.persistence.NoResultException", i'm trying to catch it but is not possible, anyhow the exception is propagated.
My source code for the Java cliente is:
try {
myobject = (MyClass) em.createNamedQuery("myquerymethod").setParameter("parameter1", value).getSingleResult();
return myobject;
}
catch (NoResultException e) {
return usr;
}

--------------- Output generated in the log window ----------------------------------------
Feb 14, 2007 6:14:37 PM com.evermind.server.ejb.logging.EJBMessages logException
SEVERE: [myFacade:public org.mypackage.persistence.myclass org.mypackage.model.myFacadeBean.myquerymethod(java.lang.String)] exception occurred during method invocation: oracle.oc4j.rmi.OracleRemoteException: javax.persistence.NoResultException: getSingleResult() did not retrieve any entities.; nested exception is:
javax.persistence.NoResultException: getSingleResult() did not retrieve any entities.
------------------------------------------------------------------------------------------------------------

Do you know why can i not catch the exception ?

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 15 2007
Added on Feb 14 2007
3 comments
1,844 views