2 Replies Latest reply on Oct 20, 2005 8:03 PM by Emmanuel Bernard

    ObjectNotFoundException: No row with the given identifier ex

    Patrik Meisinger Newbie

      i got the exception below when the client application (RCP) tries to access the database.

      the database is the backend of an old legacy system and has some inconsistent data. e.g. for a many-to-one relation it's possible that a foreign key exists without it's related primary key.
      now i don't want hibernate to throw an exception if this would happen. if found the attribute "optional" for the many-to-one annotation, but it seems this is ignored for some reason.
      i set "optional=true" for the case i described above, but i still got the exception.

      the example of my annotation:

      @ManyToOne (targetEntity=ams.ingres.model.PvStamp.class, fetch=FetchType.EAGER, optional=true)
      


      i'm using eclipse3.1, hibernate tools3.1alpha5, jbosside1.5m2, jbossas4.0.3RC1 (with ejb3.0), jdk1.5update3.

      what could i do to solve this problem?


      best regards
      patrik



      ps.: here's the stack trace of the exception

      15:26:26,770 INFO [DefaultLoadEventListener] Error performing load command
      org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ams.ingres.model.OmOkopf#679750]
       at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
       at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:121)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:170)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82)
       at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:661)
       at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:270)
       at org.hibernate.type.EntityType.resolve(EntityType.java:305)
       at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:105)
       at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:791)
       at org.hibernate.loader.Loader.doQuery(Loader.java:689)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221)
       at org.hibernate.loader.Loader.loadCollection(Loader.java:1699)
       at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
       at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:490)
       at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
       at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1437)
       at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:313)
       at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:775)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:226)
       at org.hibernate.loader.Loader.doList(Loader.java:1858)
       at org.hibernate.loader.Loader.list(Loader.java:1842)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:407)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:273)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:850)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41)
       at ams.ingres.model.facade.AkteFacade.getAllPvStamp(AkteFacade.java:50)
       at ams.ingres.model.facade.AkteFacade.getAllAkten(AkteFacade.java:85)
       at ams.beans.stateless.AktenBean.getAllAkten(AktenBean.java:29)
       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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:99)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:33)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:66)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:93)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:183)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:69)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:325)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:201)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:259)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:313)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:147)
      15:26:26,830 INFO [STDOUT] org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ams.ingres.model.OmOkopf#679750]
       at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
       at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:121)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:170)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82)
       at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:661)
       at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:270)
       at org.hibernate.type.EntityType.resolve(EntityType.java:305)
       at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:105)
       at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:791)
       at org.hibernate.loader.Loader.doQuery(Loader.java:689)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221)
       at org.hibernate.loader.Loader.loadCollection(Loader.java:1699)
       at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
       at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:490)
       at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
       at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1437)
       at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:313)
       at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:775)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:226)
       at org.hibernate.loader.Loader.doList(Loader.java:1858)
       at org.hibernate.loader.Loader.list(Loader.java:1842)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:407)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:273)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:850)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41)
       at ams.ingres.model.facade.AkteFacade.getAllPvStamp(AkteFacade.java:50)
       at ams.ingres.model.facade.AkteFacade.getAllAkten(AkteFacade.java:85)
       at ams.beans.stateless.AktenBean.getAllAkten(AktenBean.java:29)
       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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:99)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:33)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:66)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:93)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:183)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:69)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:325)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:201)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:259)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:313)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:147)