Jonas Gernot Steinke (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *commented* on HHH-16858 (
https://hibernate.atlassian.net/browse/HHH-16858?atlOrigin=eyJpIjoiYjkyZj...
)
Re: Can't compare test expression of type [BasicSqmPathSource(type : Enum)] with
element of type [basicType(a)5(java.lang.Integer,4)] (
https://hibernate.atlassian.net/browse/HHH-16858?atlOrigin=eyJpIjoiYjkyZj...
)
I tested the changes by building hibernate from source
(33a3ff2994d8412ef3c3d68ebe8af5574d05d597) and it still does not work. The error message
has changed a little (which seems unrelated to the changes from
https://github.com/hibernate/hibernate-orm/pull/6910 ) to: Cannot compare left expression
of type 'java.lang.Enum' with right expression of type
'java.lang.Integer'
Here the full stack trace:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with
name 'dataSourceScriptDatabaseInitializer' defined in
de.hibernate.test.Application: Unsatisfied dependency expressed through method
'dataSourceScriptDatabaseInitializer' parameter 3: Error creating bean with name
'itemBRepository' defined in de.hibernate.test.data.service.ItemBRepository
defined in @EnableJpaRepositories declared on
JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for
public abstract java.util.List
de.hibernate.test.data.service.ItemBRepository.findAllByTypeB2(); Reason: Validation
failed for query for method public abstract java.util.List
de.hibernate.test.data.service.ItemBRepository.findAllByTypeB2()
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:550)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1332)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:941)
~[spring-context-6.0.9.jar:6.0.9]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608)
~[spring-context-6.0.9.jar:6.0.9]
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
~[spring-boot-3.1.0.jar:3.1.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:733)
~[spring-boot-3.1.0.jar:3.1.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435)
~[spring-boot-3.1.0.jar:3.1.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
~[spring-boot-3.1.0.jar:3.1.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305)
~[spring-boot-3.1.0.jar:3.1.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294)
~[spring-boot-3.1.0.jar:3.1.0]
at de.hibernate.test.Application.main(Application.java:26) ~[classes/:na]
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
~[spring-boot-devtools-3.1.0.jar:3.1.0]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'itemBRepository' defined in
de.hibernate.test.data.service.ItemBRepository defined in @EnableJpaRepositories declared
on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for
public abstract java.util.List
de.hibernate.test.data.service.ItemBRepository.findAllByTypeB2(); Reason: Validation
failed for query for method public abstract java.util.List
de.hibernate.test.data.service.ItemBRepository.findAllByTypeB2()
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:888)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
~[spring-beans-6.0.9.jar:6.0.9]
... 22 common frames omitted
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not
create query for public abstract java.util.List
de.hibernate.test.data.service.ItemBRepository.findAllByTypeB2(); Reason: Validation
failed for query for method public abstract java.util.List
de.hibernate.test.data.service.ItemBRepository.findAllByTypeB2()
at
org.springframework.data.repository.query.QueryCreationException.create(QueryCreationException.java:101)
~[spring-data-commons-3.1.0.jar:3.1.0]
at
org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:115)
~[spring-data-commons-3.1.0.jar:3.1.0]
at
org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:99)
~[spring-data-commons-3.1.0.jar:3.1.0]
at
org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:88)
~[spring-data-commons-3.1.0.jar:3.1.0]
at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
at
org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.<init>(QueryExecutorMethodInterceptor.java:88)
~[spring-data-commons-3.1.0.jar:3.1.0]
at
org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:357)
~[spring-data-commons-3.1.0.jar:3.1.0]
at
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279)
~[spring-data-commons-3.1.0.jar:3.1.0]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:245)
~[spring-data-commons-3.1.0.jar:3.1.0]
at org.springframework.data.util.Lazy.get(Lazy.java:114)
~[spring-data-commons-3.1.0.jar:3.1.0]
at
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285)
~[spring-data-commons-3.1.0.jar:3.1.0]
at
org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132)
~[spring-data-jpa-3.1.0.jar:3.1.0]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1816)
~[spring-beans-6.0.9.jar:6.0.9]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766)
~[spring-beans-6.0.9.jar:6.0.9]
... 33 common frames omitted
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method
public abstract java.util.List
de.hibernate.test.data.service.ItemBRepository.findAllByTypeB2()
at
org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:100)
~[spring-data-jpa-3.1.0.jar:3.1.0]
at
org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:70)
~[spring-data-jpa-3.1.0.jar:3.1.0]
at
org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:60)
~[spring-data-jpa-3.1.0.jar:3.1.0]
at
org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:170)
~[spring-data-jpa-3.1.0.jar:3.1.0]
at
org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:252)
~[spring-data-jpa-3.1.0.jar:3.1.0]
at
org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:95)
~[spring-data-jpa-3.1.0.jar:3.1.0]
at
org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:111)
~[spring-data-commons-3.1.0.jar:3.1.0]
... 45 common frames omitted
Caused by: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException:
Cannot compare left expression of type 'java.lang.Enum' with right expression of
type 'java.lang.Integer'
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:141)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:165)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:171)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:790)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:700)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:125)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
at
org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360)
~[spring-orm-6.0.9.jar:6.0.9]
at jdk.proxy4/jdk.proxy4.$Proxy121.createQuery(Unknown Source) ~[na:na]
at
org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:94)
~[spring-data-jpa-3.1.0.jar:3.1.0]
... 51 common frames omitted
Caused by: org.hibernate.query.SemanticException: Cannot compare left expression of type
'java.lang.Enum' with right expression of type 'java.lang.Integer'
at
org.hibernate.query.sqm.internal.SqmCriteriaNodeBuilder.assertComparable(SqmCriteriaNodeBuilder.java:2084)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.createComparisonPredicate(SemanticQueryBuilder.java:2481)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitComparisonPredicate(SemanticQueryBuilder.java:2429)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitComparisonPredicate(SemanticQueryBuilder.java:260)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.grammars.hql.HqlParser$ComparisonPredicateContext.accept(HqlParser.java:5981)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitWhereClause(SemanticQueryBuilder.java:2282)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitWhereClause(SemanticQueryBuilder.java:260)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at org.hibernate.grammars.hql.HqlParser$WhereClauseContext.accept(HqlParser.java:5732)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitQuery(SemanticQueryBuilder.java:1127)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitQuerySpecExpression(SemanticQueryBuilder.java:918)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitQuerySpecExpression(SemanticQueryBuilder.java:260)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.grammars.hql.HqlParser$QuerySpecExpressionContext.accept(HqlParser.java:1821)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitSimpleQueryGroup(SemanticQueryBuilder.java:912)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitSimpleQueryGroup(SemanticQueryBuilder.java:260)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.grammars.hql.HqlParser$SimpleQueryGroupContext.accept(HqlParser.java:1714)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitSelectStatement(SemanticQueryBuilder.java:426)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.visitStatement(SemanticQueryBuilder.java:385)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.SemanticQueryBuilder.buildSemanticModel(SemanticQueryBuilder.java:302)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.hql.internal.StandardHqlTranslator.translate(StandardHqlTranslator.java:71)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.internal.AbstractSharedSessionContract.lambda$interpretHql$2(AbstractSharedSessionContract.java:740)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.internal.QueryInterpretationCacheStandardImpl.createHqlInterpretation(QueryInterpretationCacheStandardImpl.java:172)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.query.internal.QueryInterpretationCacheStandardImpl.resolveHqlInterpretation(QueryInterpretationCacheStandardImpl.java:158)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.internal.AbstractSharedSessionContract.interpretHql(AbstractSharedSessionContract.java:737)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
at
org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:782)
~[hibernate-core-6.3.0-SNAPSHOT.jar:6.3.0-SNAPSHOT]
... 58 common frames omitted
(
https://hibernate.atlassian.net/browse/HHH-16858#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16858#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:9e449c4 )