Please post your code and any other possible details. I tried this with a sample
application on my local JBoss-4.2.2 GA setup which uses :
2008-05-26 14:49:00,654 INFO [org.hibernate.ejb.Version] Hibernate EntityManager
3.2.1.GA
| 2008-05-26 14:49:00,701 INFO [org.hibernate.cfg.annotations.Version] Hibernate
Annotations 3.2.1.GA
| 2008-05-26 14:49:00,717 INFO [org.hibernate.cfg.Environment] Hibernate 3.2.4.sp1
|
This piece of code:
| public void testGetSingleResult(Long userId) {
| System.out.println("Testing getSingleResult --> Should throw exception is no
records found");
| System.out.println("getSingleResult returns : " +
entityManager.createQuery("from User where id = " + userId).getSingleResult());
rightly throws the following exception when i pass a non-existent user id:
| 20:14:46,893 ERROR [STDERR] Caused by: javax.persistence.NoResultException: No entity
found for query
| 20:14:46,893 ERROR [STDERR] at
org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:82)
| 20:14:46,893 ERROR [STDERR] at
org.myapp.ejb.impl.UserManagerBean.testGetSingleResult(UserManagerBean.java:262)
| 20:14:46,893 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
| 20:14:46,893 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 20:14:46,893 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 20:14:46,893 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 20:14:46,893 ERROR [STDERR] at
org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
|
P.S: Make sure your application does not package or does not have an older version of
Hibernate jar file which might be possibly resulting in this issue.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153394#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...