javax.persistence.EntityNotFoundException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I had setup bytecode instrumentation to enable nullable lazy property loading for hibernate 4.3. After the migration to hibernate 5.2.1 the lazy loading behaviour seems to be broken. The configuration I have is: For instrumentation, I've disabled everything I could and only left the lazy loading instrumentation {code:xml|title:pom.xml} <plugin> <groupId>org.hibernate.orm.tooling</groupId> <artifactId>hibernate-enhance-maven-plugin</artifactId> <version>${hibernate.version}</version> <executions> <execution> <configuration> <failOnError>true</failOnError> <enableLazyInitialization>true</enableLazyInitialization> <enableDirtyTracking>false</enableDirtyTracking> <enableAssociationManagement>false</enableAssociationManagement> <enableExtendedEnhancement>false</enableExtendedEnhancement> </configuration> <goals> <goal>enhance</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>javax.transaction</groupId> <artifactId>jta</artifactId> <version>${jta.version}</version> </dependency> </dependencies> </plugin> {code} Entity containing the lazy loaded field {code:java|title=Lazy loaded field declaration} @Entity @Table("BLAH") class ContainsALazyNullableField { ... @OneToOne(fetch = FetchType.LAZY, optional = true) @LazyToOne(LazyToOneOption.NO_PROXY) @PrimaryKeyJoinColumn @LazyGroup("groupName") private TempTableEntity tempTableEntity; ... } {code} {code:java|title=Type of the lazy field} @Entity @Table(name = "TEMP_TABLE") public class TempTableEntity { @Id @Column(name = "LAZY_FIELD_CONTAINER_ID") private String lazyFieldContainerId; ... } {code} What I get is this: {code} javax.persistence.EntityNotFoundException: Unable to find com.aa.TempTableEntity with id 0000019d-b151-4336-90a5-d41c499f7d30 at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$JpaEntityNotFoundDelegate.handleEntityNotFound(EntityManagerFactoryBuilderImpl.java:157) at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:262) at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121) at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89) at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1213) at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1096) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:639) at org.hibernate.type.EntityType.resolve(EntityType.java:431) at org.hibernate.type.EntityType.nullSafeGet(EntityType.java:262) at org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyPropertiesFromDatastore(AbstractEntityPersister.java:1063) at org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyProperty(AbstractEntityPersister.java:991) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor$1.doWork(LazyAttributeLoadingInterceptor.java:105) at org.hibernate.bytecode.enhance.spi.interceptor.Helper.performWork(Helper.java:97) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.loadAttribute(LazyAttributeLoadingInterceptor.java:76) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.fetchAttribute(LazyAttributeLoadingInterceptor.java:72) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.intercept(LazyAttributeLoadingInterceptor.java:61) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.readObject(LazyAttributeLoadingInterceptor.java:296) at com.aa.ContainsALazyNullableField.$$_hibernate_read_someOtherLazyField(ContainsALazyNullableField.java) at com.aa.ContainsALazyNullableField.getTempTableEntity(ContainsALazyNullableField.java:477) {code}
    via by Yervand Aghababyan,
  • Treat empty string in JoinColumn as null
    via Stack Overflow by g00glen00b
    ,
  • Hibernate ManyToOne mapping not on PKey
    via Stack Overflow by adept
    ,
  • Keywordscanstatus = 4
    via GitHub by Cabbina
    ,
  • Reference User class
    via openxava by medasha
    ,
    • javax.persistence.EntityNotFoundException: Unable to find com.aa.TempTableEntity with id 0000019d-b151-4336-90a5-d41c499f7d30 at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$JpaEntityNotFoundDelegate.handleEntityNotFound(EntityManagerFactoryBuilderImpl.java:157) at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:262) at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121) at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89) at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1213) at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1096) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:639) at org.hibernate.type.EntityType.resolve(EntityType.java:431) at org.hibernate.type.EntityType.nullSafeGet(EntityType.java:262) at org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyPropertiesFromDatastore(AbstractEntityPersister.java:1063) at org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyProperty(AbstractEntityPersister.java:991) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor$1.doWork(LazyAttributeLoadingInterceptor.java:105) at org.hibernate.bytecode.enhance.spi.interceptor.Helper.performWork(Helper.java:97) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.loadAttribute(LazyAttributeLoadingInterceptor.java:76) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.fetchAttribute(LazyAttributeLoadingInterceptor.java:72) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.intercept(LazyAttributeLoadingInterceptor.java:61) at org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor.readObject(LazyAttributeLoadingInterceptor.java:296) at com.aa.ContainsALazyNullableField.$$_hibernate_read_someOtherLazyField(ContainsALazyNullableField.java) at com.aa.ContainsALazyNullableField.getTempTableEntity(ContainsALazyNullableField.java:477)

    Users with the same issue

    slash
    2 times, last one,
    Pilleo
    6 times, last one,
    ivanszkypeter
    1 times, last one,
    marcbouvierdav
    1 times, last one,
    MoYapro
    1 times, last one,
    12 more bugmates