0 Replies Latest reply on May 14, 2007 1:21 PM by hstang

    javax.persistence.EntityNotFoundException

      Does anyone know why I'm getting this exception when I am using EntityHome.remove() ? I had no problems using EntityHome.remove in my other pages. I suspect it has something to do with my Entity mappings.

      What I don't understand is why this exception has anything to do with persist as I'm clearly trying to do a remove. I looked at Hibernate's code and it seems that this exception is thrown when it can't figure out what state the Entity is in (i.e. transient, detached, persistent), but I had this home object loaded with conversation-scoped entity manager like my other entity homes so it should remain as non-detached.

      Anyone got a clue?

      Caused by: javax.persistence.EntityNotFoundException: deleted entity passed to p
      ersist: [a.b.c.SomeEntity#<null>]
       at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException
      (AbstractEntityManagerImpl.java:613)
       at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManag
      erImpl.java:299)
       at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProx
      y.java:83)
       at org.jboss.seam.framework.EntityHome.remove(EntityHome.java:60)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocation
      Context.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
      Context.java:57)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundIn
      voke(ManagedEntityIdentityInterceptor.java:37)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
      Context.java:69)
       at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(Rollback
      Interceptor.java:34)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
      Context.java:69)
       at org.jboss.seam.interceptors.TransactionInterceptor$1.work(Transaction
      Interceptor.java:32)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
       at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(Trans
      actionInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
      Context.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(Met
      hodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
      Context.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:
      103)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(Java
      BeanInterceptor.java:151)
       at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanIntercept
      or.java:87)
       at org.jboss.seam.framework.EntityHome_$$_javassist_51.remove(EntityHome
      _$$_javassist_51.java)