-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 
Author Message
 Post subject: ObjectNotFoundException thrown after delete?!
PostPosted: Fri Jun 16, 2006 7:52 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
When I attempt to delete an entity object using the code below, I receive an ObjectNotFoundException at the delete method call. The row in the DB is successfully deleted, but I get this erroneous exception. What's going on?

I'm using Annotations, but I don't think this issue has to do with those.

Info:
Hibernate version: 3.2CR2 w/Annotations 3.2CR1

Annotated class:
Code:
package ...

import ...

@Entity
@Table(catalog = "cms",
  uniqueConstraints = { @UniqueConstraint(columnNames = { "publicationGroupId", "name" }) })
public class ArticleState {
  private static final long serialVersionUID = -3033537834500910172L;

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(nullable = false, updatable = false)
  public long getId() { return _id; }
  public void setId(long arg) { _id = arg; }
  private long _id = 0;

  @Basic
  @Column(length = 20, nullable = false, updatable = true)
  @NotNull
  @Length(min = 1, max = 20)
  public String getName() { return _name; }
  public void setName(String arg) { _name = arg; }
  private String _name = null;

  @Basic
  @Column(precision = 2, scale = 1, nullable = false, updatable = true)
  @NotNull
  @Min(0)
  public double getSequenceNumber() { return _sequenceNumber; }
  public void setSequenceNumber(double arg) { _sequenceNumber = arg; }
  private double _sequenceNumber;

  @Basic
  @Column(nullable = false, updatable = true)
  public boolean isActive() { return _active; }
  public void setActive(boolean arg) { _active = arg; }
  private boolean _active = true;

  @ManyToOne
  @JoinColumn(name = "publicationGroupId", nullable = false)
  @LazyToOne(LazyToOneOption.FALSE)
  @Fetch(FetchMode.JOIN)
  public PublicationGroup getPublicationGroup() { return _publicationGroup; }
  public void setPublicationGroup(PublicationGroup arg) { _publicationGroup = arg; }
  private PublicationGroup _publicationGroup = null;
}


Code between sessionFactory.openSession() and session.close():
Code:
          ArticleState item = (ArticleState)s.load(ArticleState.class, 7);
          s.delete(item);


Abbreviated stack trace:
Code:
Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxxxx.webpubplat.cms.model.ArticleState#7]
   at org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:372)
   at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:79)
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:68)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
   at org.hibernate.engine.StatefulPersistenceContext.unproxyAndReassociate(StatefulPersistenceContext.java:537)
   at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:50)
   at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:768)
   at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:746)


Name and version of the database you are using: MySQL 5.0.21

The generated SQL (show_sql=true): None for the delete shown in log.
Debug level Hibernate log excerpt:
Code:
07:38:33,807 DEBUG [http-8080-Processor24] (SessionImpl.<init>:222) opened session at timestamp: 4712275614953472
07:38:33,807 DEBUG [http-8080-Processor24] (SessionImpl.immediateLoad:825) initializing proxy: [com.xxxxx.webpubplat.cms.model.ArticleState#8]
07:38:33,807 DEBUG [http-8080-Processor24] (Loader.loadEntity:1777) loading entity: [com.xxxxx.webpubplat.cms.model.ArticleState#8]
07:38:33,823 DEBUG [http-8080-Processor24] (AbstractBatcher.log:393)
    /* load com.xxxxx.webpubplat.cms.model.ArticleState */ select
        articlesta0_.id as id19_1_,
        articlesta0_.name as name19_1_,
        articlesta0_.sequenceNumber as sequence7_19_1_,
        articlesta0_.publicationGroupId as publicat9_19_1_,
        articlesta0_.active as active19_1_,
        publicatio1_.id as id15_0_,
        publicatio1_.name as name15_0_
    from
        cms.ArticleState articlesta0_
    inner join
        cms.PublicationGroup publicatio1_
            on articlesta0_.publicationGroupId=publicatio1_.id
    where
        articlesta0_.id=?
Hibernate:
    /* load com.xxxxx.webpubplat.cms.model.ArticleState */ select
        articlesta0_.id as id19_1_,
        articlesta0_.name as name19_1_,
        articlesta0_.sequenceNumber as sequence7_19_1_,
        articlesta0_.publicationGroupId as publicat9_19_1_,
        articlesta0_.active as active19_1_,
        publicatio1_.id as id15_0_,
        publicatio1_.name as name15_0_
    from
        cms.ArticleState articlesta0_
    inner join
        cms.PublicationGroup publicatio1_
            on articlesta0_.publicationGroupId=publicatio1_.id
    where
        articlesta0_.id=?
07:38:33,839 DEBUG [http-8080-Processor24] (StatefulPersistenceContext.initializeNonLazyCollections:748) initializing non-lazy collections
07:38:33,854 DEBUG [http-8080-Processor24] (Loader.loadEntity:1808) done entity load
07:38:33,854  INFO [http-8080-Processor24] (AbstractSessionHandler.perform:52) Operation removeArticleState failed.
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxxxx.webpubplat.cms.model.ArticleState#8]
   at org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:372)
   at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:79)
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:68)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
   at org.hibernate.engine.StatefulPersistenceContext.unproxyAndReassociate(StatefulPersistenceContext.java:537)
   at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:50)
   at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:768)
   at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:746)
   at com.xxxxx.webpubplat.util.hibernate.EntityOps$4.handle(EntityOps.java:185)
   at com.xxxxx.webpubplat.util.hibernate.EntityOps$4.handle(EntityOps.java:1)
   at com.xxxxx.webpubplat.util.hibernate.AbstractSessionHandler.perform(AbstractSessionHandler.java:48)
   at com.xxxxx.webpubplat.util.hibernate.EntityOps.remove(EntityOps.java:188)
   at com.xxxxx.webpubplat.cms.CmsServiceHibernateImpl.remove(CmsServiceHibernateImpl.java:72)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy49.remove(Unknown Source)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate.wipeEntity(DeleteEntityDelegate.java:49)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate.ArticleState(DeleteEntityDelegate.java:61)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate$$FastClassByCGLIB$$f14627aa.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
   at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:709)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:647)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate$$EnhancerByCGLIB$$4eddc31d.ArticleState(<generated>)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:433)
   at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:371)
   at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy55.handleRequest(Unknown Source)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy59.handle(Unknown Source)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:797)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:727)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
07:38:34,573 ERROR [http-8080-Processor24] (StandardWrapperValve.invoke:253) Servlet.service() for servlet adminui threw exception
DataOperationException: Message='org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxxxx.webpubplat.cms.model.ArticleState#8]' Cause='org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxxxx.webpubplat.cms.model.ArticleState#8]'
   at com.xxxxx.webpubplat.util.hibernate.AbstractSessionHandler.perform(AbstractSessionHandler.java:61)
   at com.xxxxx.webpubplat.util.hibernate.EntityOps.remove(EntityOps.java:188)
   at com.xxxxx.webpubplat.cms.CmsServiceHibernateImpl.remove(CmsServiceHibernateImpl.java:72)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy49.remove(Unknown Source)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate.wipeEntity(DeleteEntityDelegate.java:49)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate.ArticleState(DeleteEntityDelegate.java:61)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate$$FastClassByCGLIB$$f14627aa.invoke(<generated>)
   at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
   at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:709)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:647)
   at com.xxxxx.webpubplat.admin.mvc.DeleteEntityDelegate$$EnhancerByCGLIB$$4eddc31d.ArticleState(<generated>)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:433)
   at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:371)
   at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy55.handleRequest(Unknown Source)
   at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:118)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:53)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy59.handle(Unknown Source)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:797)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:727)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxxxx.webpubplat.cms.model.ArticleState#8]
   at org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:372)
   at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:79)
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:68)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
   at org.hibernate.engine.StatefulPersistenceContext.unproxyAndReassociate(StatefulPersistenceContext.java:537)
   at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:50)
   at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:768)
   at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:746)
   at com.xxxxx.webpubplat.util.hibernate.EntityOps$4.handle(EntityOps.java:185)
   at com.xxxxx.webpubplat.util.hibernate.EntityOps$4.handle(EntityOps.java:1)
   at com.xxxxx.webpubplat.util.hibernate.AbstractSessionHandler.perform(AbstractSessionHandler.java:48)
   ... 89 more


Last edited by tharrisx on Sun Jun 18, 2006 4:24 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Help?
PostPosted: Sun Jun 18, 2006 4:22 pm 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
No help? Please, I have a demo for my client tomorrow, and I'd like this to work properly. Thanks.


Top
 Profile  
 
 Post subject: Hello?
PostPosted: Fri Jul 07, 2006 9:31 pm 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
I remember this forum when people used to respond... It's been a really long time now, and not one person has responded to my request for help on this. This is most probably a bug in Hibernate, and I'd like some advice here...

In order for my demo to go over, I had to write code to eat the particular exception just before the UI was to display it, however this is incredibly ugly, and I'd like to get the problem under control. I've been a big Hibernate advocate since I began using it in 2003, and our current project is based around it. A lot is riding on my ability to prove this technology at my new company, and with no support community any longer, I expect I will be asked to base this and other future projects on a different persistence mechanism. It's not really in my hands.

Let's prove them wrong, and find the original spirit of these forums, the biggest reason Hibernate was adopted so quickly in my opinion.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 11:04 am 
Newbie

Joined: Thu Jul 06, 2006 1:01 pm
Posts: 4
If you are still around, I had the same problem. I was using HSQL for testing and this problem came up only while running JUnit test cases. It surprisingly worked fine in production environments where we were using MS SQL Server 2000/2005.

Can you try using another DB rather than MySQL?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 11:07 am 
Newbie

Joined: Thu Jul 06, 2006 1:01 pm
Posts: 4
One more thing. This problem did not arise when you explictly open a session and begin a transaction using Hibernate provided classes.

From the stacktrace I can see that you are using Spring. Are you using getHibernateTemplate().delete(...) by any chance?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 8:16 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
Thanks for responding! I'm not using the Spring helpers. And this does happen for me in production. I'm using annotations, and the problem didn't happen when I originally had my annotations on the entity fields. When I moved the annotations to the accessor methods on my entities, I started seeing this issue. I needed to have the annotations on the methods in order to be able to do proper inheritance, so I'm at a loss as to how to get around the problem cleanly.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 8:20 am 
Newbie

Joined: Thu Jul 06, 2006 1:01 pm
Posts: 4
Don't think Annotations have got anything to do with this. (They should not!). Can you try reverting back to putting annots on your fields, just to make sure that this problem arose from migrating the annots? Or is that too much of a pain now?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 10:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
If you load/delete ArticleState#7, then how does ArticleState#8 come into the picture (from the stack trace)?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 8:23 pm 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
Can't put the annotations back onto the fields because I have subclasses that add additional fields via composition and such, in other places.

Oh, and the #7 vs. #8 was simply from two different runs. Be assured that the problem shows the ID of the entity in question.

Tom


Top
 Profile  
 
 Post subject: Still happening...
PostPosted: Sun Oct 08, 2006 7:52 pm 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
This problem still occurs, and I haven't heard from anyone yet on a solution or a defect acknowledgement. Anyone?

Tom


Top
 Profile  
 
 Post subject: Anyone?
PostPosted: Thu Oct 26, 2006 8:05 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
This problem is still occurring. Does anyone know if this is a bug or if I'm doing something odd here?

I'm on the 3.2 GA versions now.

Tom


Top
 Profile  
 
 Post subject: Still happening
PostPosted: Sat Feb 10, 2007 5:10 pm 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
I'm on 3.2.2 Hibernate and 3.2.1 GA of Annotations/EntityManager, and I'm still having this problem. Anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 12:16 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
Hi tharrisx,

I did not understand your code .But still I would like to give some hypothesis. If you are using transaction annotation .that means transaction will start from that method at which you have applied annotation. Let say if you are loading Entities between that method and storing in collection then also you need to remove those entity from collection. Let say your Entity ArticleState is loaded in session and have some reference there in between method. But if you are deleting it by HQl or by some trigger Session would go out of sync. In your case might be the problem that you are passing Entity By ID in transaction method. mean while you are deleting the entity. But references are still there in collection .And if the collection is going in the session for some update. And you have select before update =true, then before going for update is will select for load and in loading you are getting these exception.

Make sure tha you have removed all the reference before delete .

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject: same error
PostPosted: Tue Feb 13, 2007 5:28 pm 
Newbie

Joined: Fri Feb 24, 2006 2:00 pm
Posts: 4
i'm getting this same error, and from what i can see, it's because i still have pointers in one table pointing to records that don't exist in others. ie:

Code:
table a
1    peter    boss
2    randy    minion
3    chuck    janitor

table b
boss       $500,000
minion     $14,000
janitor    $2,000


i then delete the 'janitor' master record:

Code:
table a
1    peter    boss
2    randy    minion
3    chuck    janitor

table b
boss       $500,000
minion     $14,000


but chuck still has a foreign key reference to it, so when i pull up chuck, i get the objectnotfound error because it can't find the janitor record.

so in my case, it's not a problem with hibernate at all, it's a logical problem with how i discriminate what records to pull up. may case might be differnet though, cause i don't actually delete the record, i just mark it with an inactive flag, and prevent it from getting pulled into the hibernate layer using a class-level where clause in my hbm.xml. which i'm now wondering if that's the best way to do it. regardless, does that provide any insite to your problem?

nikhil


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.