Caused by: org.hibernate.query.SemanticException: Cannot compare left expression of type 'java.io.Serializable' with right expression of type 'java.lang.Long'

Caused by: org.hibernate.query.SemanticException: Cannot compare left expression of type 'java.io.Serializable' with right expression of type 'java.lang.Long'
	at org.hibernate.query.sqm.internal.TypecheckUtil.assertComparable(TypecheckUtil.java:338)
	at org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate.<init>(SqmComparisonPredicate.java:48)
	at org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate.<init>(SqmComparisonPredicate.java:34)
	at org.hibernate.query.sqm.internal.SqmCriteriaNodeBuilder.equal(SqmCriteriaNodeBuilder.java:2070)
	at org.hibernate.query.sqm.internal.SqmCriteriaNodeBuilder.equal(SqmCriteriaNodeBuilder.java:189)
	at org.springframework.data.jpa.repository.query.JpaQueryCreator$PredicateBuilder.build(JpaQueryCreator.java:312)
	at org.springframework.data.jpa.repository.query.JpaQueryCreator.toPredicate(JpaQueryCreator.java:210)
	at org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:121)
	at org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:60)
	at org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:119)
	at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:95)
	at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:81)
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.<init>(PartTreeJpaQuery.java:218)
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$CountQueryPreparer.<init>(PartTreeJpaQuery.java:361)
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:102)
	... 54 common frames omitted

spring-data-jpa issues: Caused by: org.hibernate.query.SemanticException: Cannot compare left expression of type 'java.io.Serializable' with right expression of type 'java.lang.Long' · Issue #3235 · spring-projects/spring-data-jpa · GitHub

Use this example to reproduce:

https://github.com/spring-projects/spring-data-jpa/files/13422002/issues-3235.zip

Hello and thank you for reporting this issue here too. I’ve created this Jira ticket [HHH-17454] - Hibernate JIRA, you can follow that for any updates.

Can this version be fixed in version 6.3? Springboot3.2 currently relies on hibernate6.3x.

Please see my reply on the Jira.

Hi, is there a fix for the problem, I had to rollback from 3.2 to 3.1.8 due to incompatibility

I have this problem with spring boot 3.2 and hubernate 6.3
Even rollback to spring boot 3.1.8 and hibernate 6.1 didn’t solve the problem.

Any help !!