javax.persistence.EntityNotFoundException: Unable to find mobi.database.domain.Server with id 249

Hibernate JIRA | Koda Janh | 1 decade ago
  1. 0

    I am issuing the query: "select user from " + User.class.getName() + " as user" and I am getting this stack-trace: javax.persistence.EntityNotFoundException: Unable to find mobi.database.domain.Server with id 249 at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:107) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:143) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:193) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:101) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266) at org.hibernate.type.EntityType.resolve(EntityType.java:303) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842) at org.hibernate.loader.Loader.doQuery(Loader.java:717) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2144) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64) I've tracked down the problem to a "@Column(nullable=false)". Specifically, if one of the objects in the result-set contain a null field that is defined as "nullable=false" then the above exception will occur. This behavior should either be documented in the Javadoc or the implementation should be changed to throw one of the declared exceptions instead. Also, the actual error message is misleading in that the specified object *is* found, but it violates the constraints of the ORM mapping.

    Hibernate JIRA | 1 decade ago | Koda Janh
    javax.persistence.EntityNotFoundException: Unable to find mobi.database.domain.Server with id 249
  2. 0

    I am issuing the query: "select user from " + User.class.getName() + " as user" and I am getting this stack-trace: javax.persistence.EntityNotFoundException: Unable to find mobi.database.domain.Server with id 249 at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:107) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:143) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:193) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:101) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878) at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266) at org.hibernate.type.EntityType.resolve(EntityType.java:303) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842) at org.hibernate.loader.Loader.doQuery(Loader.java:717) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2144) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64) I've tracked down the problem to a "@Column(nullable=false)". Specifically, if one of the objects in the result-set contain a null field that is defined as "nullable=false" then the above exception will occur. This behavior should either be documented in the Javadoc or the implementation should be changed to throw one of the declared exceptions instead. Also, the actual error message is misleading in that the specified object *is* found, but it violates the constraints of the ORM mapping.

    Hibernate JIRA | 1 decade ago | Koda Janh
    javax.persistence.EntityNotFoundException: Unable to find mobi.database.domain.Server with id 249
  3. 0

    ManyToOne gives EntityNotFoundException | JBoss Developer

    jboss.org | 7 months ago
    javax.ejb.EJBException: javax.persistence.EntityNotFoundException: Unable to find A with id 1.1234567890123
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    JPA/Hibernate, Spring Roo: can Repository and ActiveRecord coexist?

    Stack Overflow | 4 years ago | balteo
    javax.persistence.EntityNotFoundException: Unable to find trc.suivi.domain.Destinataire with id 892
  6. 0

    Problem with the Album example - Spring Forum

    spring.io | 12 months ago
    org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Unable to find com.myco.album.domain.Artist with id 2; nested exception is javax.persistence.EntityNotFoundException: Unable to find com.myco.album.domain.Artist with id 2

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.persistence.EntityNotFoundException

      Unable to find mobi.database.domain.Server with id 249

      at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound()
    2. Hibernate EJB
      Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound
      1. org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:107)
      1 frame
    3. Hibernate
      SessionImpl.internalLoad
      1. org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:143)
      2. org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:193)
      3. org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:101)
      4. org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
      5. org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
      5 frames
    4. Hibernate
      QueryLoader.list
      1. org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
      2. org.hibernate.type.EntityType.resolve(EntityType.java:303)
      3. org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
      4. org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
      5. org.hibernate.loader.Loader.doQuery(Loader.java:717)
      6. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      7. org.hibernate.loader.Loader.doList(Loader.java:2144)
      8. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
      9. org.hibernate.loader.Loader.list(Loader.java:2023)
      10. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
      10 frames
    5. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.list
      1. org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      1 frame
    6. Hibernate
      QueryImpl.list
      1. org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      2. org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      3. org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      3 frames
    7. Hibernate EJB
      QueryImpl.getResultList
      1. org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
      1 frame