ClassCastException when batch-fetching association in embeddable

Description

After upgrading from 6.1.0 to 6.1.1 many of our tests fail with the following ClassCastException:

java.lang.ClassCastException: class org.hibernate.sql.results.graph.embeddable.internal.EmbeddableFetchInitializer cannot be cast to class org.hibernate.sql.results.graph.entity.AbstractEntityInitializer (org.hibernate.sql.results.graph.embeddable.internal.EmbeddableFetchInitializer and org.hibernate.sql.results.graph.entity.AbstractEntityInitializer are in unnamed module of loader 'app') at org.hibernate.sql.results.graph.entity.internal.BatchEntitySelectFetchInitializer.endLoading(BatchEntitySelectFetchInitializer.java:225) at org.hibernate.sql.results.internal.StandardRowReader.finishUp(StandardRowReader.java:161) at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:168) at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:32) at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.doExecuteQuery(JdbcSelectExecutorStandardImpl.java:443) at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.executeQuery(JdbcSelectExecutorStandardImpl.java:166) at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.list(JdbcSelectExecutorStandardImpl.java:91) at org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:31) at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.lambda$new$0(ConcreteSqmSelectQueryPlan.java:102) at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:305) at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:246) at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:546) at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:363) at org.hibernate.query.sqm.internal.QuerySqmImpl.list(QuerySqmImpl.java:1032)

I can try to create a reproducer in the next days, but I think the stracktrace should provide enough information about the problem.

Activity

Show:

Andrea Boriero November 7, 2022 at 2:19 PM

Hi ,

I’m working on it right now, and yes the test you provided is enough, thanks a lot.

Thomas Heigl November 7, 2022 at 1:47 PM

@Andrea Boriero: Did you get a chance to look at my test-case. Is it enough for you to diagnose the issue?

Thomas Heigl November 2, 2022 at 12:56 PM

This issue happens when an embeddable contains a relation (OneToOne or ManyToOne) and batch-fetching is enabled.

Thomas Heigl October 31, 2022 at 7:45 AM

Andrea Boriero October 31, 2022 at 7:44 AM

Thanks a lot .

Fixed

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created October 29, 2022 at 12:11 PM
Updated December 7, 2022 at 2:24 PM
Resolved November 18, 2022 at 11:57 AM