Skip to content

Conversation

@jimsimon-wk
Copy link
Contributor

@jimsimon-wk jimsimon-wk commented Jan 10, 2025

A ClassCastException is thrown when trying to resolve instances without bytecode enhancement enabled under these preconditions:

Related Change in Hibernate 6.6

Reproducer


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19017

Copy link
Member

@mbellade mbellade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jimsimon-wk! Just left a few minor comments, but other than that your change looks good to me.

@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Jan 16, 2025

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

@jimsimon-wk jimsimon-wk force-pushed the HHH-19017 branch 2 times, most recently from 620a985 to ca7c629 Compare January 16, 2025 00:47
@jimsimon-wk
Copy link
Contributor Author

Thanks for the helpful review @mbladel! I thought I had imported the codestyles to IntelliJ, but I must have forgotten to apply formatting. This moved things around a little in the unit test too

Copy link
Member

@beikov beikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems your last commit has a typo i.e. you used HHH-19107 instead of HHH-19017 in the commit message. After fixing that, the PR can IMO be merged.

@jimsimon-wk jimsimon-wk force-pushed the HHH-19017 branch 3 times, most recently from 353fe18 to a0e1fbf Compare January 21, 2025 14:41
@jimsimon-wk
Copy link
Contributor Author

It seems your last commit has a typo i.e. you used HHH-19107 instead of HHH-19017 in the commit message. After fixing that, the PR can IMO be merged.

TIL about reword when rebasing... I think we should be good to go now. Thanks for catching @beikov

@jimsimon-wk
Copy link
Contributor Author

@beikov CI failed on codestyles, so I had to push more updates. Are you able to start the workflow again? Is there a timeline yet on when we can expect this to merge and get released?

@mbellade
Copy link
Member

mbellade commented Feb 5, 2025

@jimsimon-wk could you please squash all commits to a single one (or one for the test and another for the fix)? After that we can go ahead and merge.

@jimsimon-wk
Copy link
Contributor Author

jimsimon-wk could you please squash all commits to a single one (or one for the test and another for the fix)? After that we can go ahead and merge.

@mbladel No problem. The branch should now be one commit after my last push

@beikov beikov merged commit 98ec951 into hibernate:main Feb 11, 2025
22 of 24 checks passed
@HJK181
Copy link
Contributor

HJK181 commented Mar 28, 2025

@beikov @mbladel I’m facing the same issue after updating to the newest Spring Boot 3.4.4 version, which pulls in Hibernate 6.6.11.Final

java.lang.ClassCastException: Object of type 'class io.searchhub.domain.ProblematicQuery' can't be cast to PersistentAttributeInterceptable

	at org.hibernate.engine.internal.ManagedTypeHelper.asPersistentAttributeInterceptable(ManagedTypeHelper.java:287)
	at org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchInitializer.resolveInstance(EntityDelayedFetchInitializer.java:208)
	at org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchInitializer.resolveInstance(EntityDelayedFetchInitializer.java:51)
	at org.hibernate.sql.results.internal.StandardRowReader.coordinateInitializers(StandardRowReader.java:239)
	at org.hibernate.sql.results.internal.StandardRowReader.readRow(StandardRowReader.java:141)
	at org.hibernate.sql.results.spi.ListResultsConsumer.read(ListResultsConsumer.java:249)
	at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:201)
	at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:35)
	at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.doExecuteQuery(JdbcSelectExecutorStandardImpl.java:224)
	at org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.executeQuery(JdbcSelectExecutorStandardImpl.java:102)
	at org.hibernate.sql.exec.spi.JdbcSelectExecutor.executeQuery(JdbcSelectExecutor.java:91)
	at org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:165)
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.lambda$new$1(ConcreteSqmSelectQueryPlan.java:152)
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:442)
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:362)
	at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:380)
	at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:143)
	at org.hibernate.query.Query.getResultList(Query.java:120)
	at org.springframework.data.jpa.repository.support.FetchableFluentQueryBySpecification.all(FetchableFluentQueryBySpecification.java:160)

Would you please be so kind to apply this fix to the 6.6 branch as well and do a bugfix release?

@beikov
Copy link
Member

beikov commented Mar 28, 2025

I already backported this via #9921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants