Issues
- FetchNotFoundException after Upgrade to 6.6.XHHH-19273
- Secondary table with nested embedded objectHHH-19272
- support HINT_FETCH_PROFILE in SelectionQueryHHH-19271Resolved issue: HHH-19271Gavin King
- Remove LGPL-only contributions to EnversHHH-19270Resolved issue: HHH-19270Yoann Rodière
- Remove support for @Audited(modifiedColumnName = ...)HHH-19269Resolved issue: HHH-19269Yoann Rodière
- StatementInspector not working with "ddl-auto=create" or SchemaManagerHHH-19268
- Allow Hibernate Reactive to override methods in JdbcEnvironemntInitiatorHHH-19267Resolved issue: HHH-19267Davide D'Alto
- inconsistencies in ScrollableResultsHHH-19266Resolved issue: HHH-19266Gavin King
- deprecate hibernate.jdbc.use_scrollable_resultsetHHH-19265Resolved issue: HHH-19265Gavin King
- Add a TimestampWithTimeZoneJdbcType variant that uses ZonedDateTime instead of OffsetDateTime to bind/extract column valuesHHH-19264
- Do not bind to JNDI if hibernate.session_factory_name_is_jndi is set to falseHHH-19263
- OracleDialect getQueryHintString incorrectly joins supplied hintsHHH-19261
- Move feature supports methods from the SqlAstTranslator base impl to DialectHHH-19260Jan Schatteman
- Static metamodel for id/timestamp not set (and triggers warnings) for DefaultRevisionEntity and similarHHH-19259
- Remove @Entity annotation from default revision entities contributed internally by EnversHHH-19258
- Provide a way to specify the secondary table to which an embedded mapsHHH-19257
- Criteria SUM expression return type errorHHH-19256Resolved issue: HHH-19256
- Cannot setup Column Names, Types, ForeignKeys in generated DDLHHH-19255Resolved issue: HHH-19255
- The return value of st_envelope() is not recognised as a geometry type on MariaDBHHH-19254Resolved issue: HHH-19254Karel Maesen
- deprecate use of lifecycle callbacks on embeddablesHHH-19253Resolved issue: HHH-19253Gavin King
- overriding @Id generation declared by @MappedSuperclassHHH-19252Resolved issue: HHH-19252Gavin King
- Use the "temp classloader" model to always build hibernate-modelsHHH-19251
- HHHHHH-19250Resolved issue: HHH-19250
- Issue with orphanRemoval = true and FetchType.LAZY in Hibernate 6.6.X.FinalHHH-19249
- Return of deleted entities doesn't work with naturalid multiloadingHHH-19248Jan Schatteman
- Make it possible to order type contributions analogous to function contributionsHHH-19247
- Fetch join makes partially covered EntityGraph ineffectiveHHH-19246Resolved issue: HHH-19246Christian Beikov
- Make unary and binary operators easier to extendHHH-19245
- ConnectionReleaseMode.AFTER_STATEMENT ineffective for queriesHHH-19244
- jpa/core/convert TCK failure caused by "AttributeConverter' not allowed for attribute 'getId' annotated '@jakarta.persistence.Id' (use '@Convert(disableConversion=true)' to suppress this error)"HHH-19243
- EntityGraph.addSubgraph fails on entity attribute with more than one level of inheritanceHHH-19242
- Investigate proper bytecode enhancement of attributes with PROPERTY accessHHH-19241
- Significant increase in heap allocation for queries after migrating Hibernate ORM 6.5 to 6.6HHH-19240
- Ensure and validate explicit @Access annotation value on fields / gettersHHH-19239
- order_inserts doesn't consider primary keysHHH-19238
- Expand graph language to optionally specify entityHHH-19237Resolved issue: HHH-19237Steve Ebersole
- PersistenceConfiguration.SCHEMAGEN_CREATE_TARGET doesn't seem to workHHH-19236
- Ability to eager batch fetch associations based on non-pk fkHHH-19235
- Ability to configure cursor holdabiltyHHH-19234Resolved issue: HHH-19234
- AssertionError after Upgrade to Hibernate 6.6.8HHH-19233
- BeanValidationEventListener not called if only associated collection is updated via getterHHH-19232Resolved issue: HHH-19232Marco Belladelli
- Composite User Types provided through TypeContributor are incorrectly registeredHHH-19231
- Ensure that thread local for org.hibernate.bytecode.enhance.internal.bytebuddy.SafeCacheProvider + OverridingClassFileLocator are completely clearedHHH-19230Christian Beikov
- Faster checks in ReflectHelperHHH-19229Olivier Bourgain
- Upgrade MySQL testing to version 9.2HHH-19228
- errors in class OracleSDOFunctionDescriptorsHHH-19227Resolved issue: HHH-19227Karel Maesen
- Remove support for SQL Server versions older than 2016HHH-19226
- Remove support for MariaDB versions older than 10.6HHH-19225
- TransientObjectException on session.remove()HHH-19224
- Upgrade JBoss Logging Tools (processor) to 3.0.4.FinalHHH-19223Marko Bekhta
50 of
FetchNotFoundException after Upgrade to 6.6.X
Description
Details
Details
Assignee
Unassigned
UnassignedReporter
Joris Thiele
Joris ThielePriority
Created 3 hours ago
Updated 3 hours ago
Activity
Show:
After an upgrade from 6.4.8.Final to 6.6.5.Final, there seems to be an issue with executing the following queries.
They still work as expected in 6.5.3.Final and stopped working from 6.6.0.Final onwards. The issue persists in 6.6.11.Final.
We receive the following exception when executing the test case:
org.hibernate.FetchNotFoundException: Entity 'custom.MyBEntity' with identifier value 'B1' does not exist
Reproducer:
package org.hibernate.bugs; import custom.MyAEntity; import custom.MyBEntity; import custom.MyCEntity; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.NonUniqueResultException; import jakarta.persistence.Persistence; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.List; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; /** * This template demonstrates how to develop a test case for Hibernate ORM, using the Java Persistence API. */ class JPAUnitTestCase { private EntityManagerFactory entityManagerFactory; @BeforeEach void init() { entityManagerFactory = Persistence.createEntityManagerFactory( "templatePU" ); } @AfterEach void destroy() { entityManagerFactory.close(); } // Entities are auto-discovered, so just add them anywhere on class-path // Add your tests, using standard JUnit. @Test void testFetchNotFoundException() throws Exception { EntityManager entityManager = entityManagerFactory.createEntityManager(); // Given entityManager.getTransaction().begin(); var newB = new MyBEntity("B1", 1); var newC = new MyCEntity("C1"); entityManager.persist(newB); entityManager.persist(newC); entityManager.getTransaction().commit(); // When entityManager.getTransaction().begin(); getB(entityManager, "B1"); getAListForB(entityManager, "B1"); var newAEntity = new MyAEntity(); newAEntity.setId("A1"); newAEntity.setBId("B1"); newAEntity.setCId("C1"); entityManager.merge(newAEntity); // Then assertDoesNotThrow(() -> getAListForC(entityManager, "C1", 1)); entityManager.getTransaction().commit(); entityManager.close(); } private MyBEntity getB(EntityManager entityManager, String bId) { var query = entityManager.createQuery(""" SELECT b FROM MyBEntity b WHERE b.id = :id """, MyBEntity.class); query.setParameter("id", bId); var list = query.getResultList(); if (list == null || list.isEmpty()) return null; else if (list.size() > 1) throw new NonUniqueResultException(); else return list.get(0); } private List<MyAEntity> getAListForB(EntityManager entityManager, String bId) { var query = entityManager.createQuery(""" SELECT DISTINCT a FROM MyAEntity a JOIN a.c c JOIN a.b b where a.bId = :bId AND c.deletedOn IS NULL """, MyAEntity.class); query.setParameter("bId", bId); return query.getResultList(); } private List<MyAEntity> getAListForC(EntityManager entityManager, String cId, Integer someNumber) { var query = entityManager.createQuery(""" SELECT DISTINCT a FROM MyAEntity a JOIN FETCH a.c c JOIN FETCH a.b b where b.someNumber = :someNumber and a.cId = :cId """, MyAEntity.class); query.setParameter("cId", cId); query.setParameter("someNumber", someNumber); return query.getResultList(); } } @Getter @Setter @EqualsAndHashCode(of = {"id"}) @Entity public class MyAEntity { @Id @Column(name = "ID", nullable = false) private String id; @Column(name = "B_ID", nullable = false) private String bId; @Column(name = "C_ID", nullable = false) private String cId; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "B_ID", nullable = false, insertable = false, updatable = false) private MyBEntity b; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "C_ID", nullable = false, insertable = false, updatable = false) private MyCEntity c; } @Setter @Getter @Entity public class MyBEntity { @Id @Column(name = "ID", nullable = false) private String id; @Column(name = "SOME_NUMBER", nullable = false) private Integer someNumber; @Setter(AccessLevel.NONE) @OneToMany(mappedBy = "b", fetch = FetchType.LAZY) private List<MyAEntity> aList; public MyBEntity() {} public MyBEntity(String id, Integer someNumber) { this.id = id; this.someNumber = someNumber; } } @Setter @Getter @Entity public class MyCEntity { @Id @Column(name = "ID", nullable = false) private String id; @Column(name = "DELETED_ON") private Date deletedOn; @OneToMany(mappedBy = "c", fetch = FetchType.EAGER) private List<MyAEntity> aList; public MyCEntity() {} public MyCEntity(String id) { this.id = id; } }
See also the following post in the Hibernate forum: https://discourse.hibernate.org/t/fetchnotfoundexception-after-upgrade-to-6-6-x/11229