Skip to content

ConverterNotFoundException exception in hql spring-data-jpa-3.1.0  #2990

Closed as not planned
@teopapath

Description

@teopapath

I have a NamedQuery like:

@NamedQuery(
        name = exampleQuery,
        query = "select new Pojo("
                + "au.userId, au.status, r.name, r.code, au.creationDate) "
                + "from Au au "
                + "join Role r on r.code = au.code "
                + "where au.accountId = :accountId "
                + "and au.status <> 'PENDING' ")

When query is executed a ConverterNotFoundException is thrown.

If i change the query to

@NamedQuery(
        name = exampleQuery,
        query = "select new Pojo("
                + "au.userId, au.status, r.name, r.code, au.creationDate) "
                + "from Au au "
                + "join Role r on r.code = au.code "
                + "where au.accountId = :accountId "
                + "and au.status not in ('PENDING') ")

everything works as expected.
It seems that there is a problem in parsing this part: and au.status <> 'PENDING'
The same query was executing successfully in spring-boot 3.0.7

Stacktrace:

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [Pojo]
	at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:322) ~[spring-core-6.0.9.jar:6.0.9]
	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195) ~[spring-core-6.0.9.jar:6.0.9]
	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:175) ~[spring-core-6.0.9.jar:6.0.9]
	at org.springframework.data.repository.query.ResultProcessor$ProjectingConverter.convert(ResultProcessor.java:305) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.lambda$and$0(ResultProcessor.java:233) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:240) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:160) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:151) ~[spring-data-jpa-3.1.0.jar:3.1.0]
	at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:136) ~[spring-data-jpa-3.1.0.jar:3.1.0]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:136) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:120) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:164) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.9.jar:6.0.9]
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:77) ~[spring-data-commons-3.1.0.jar:3.1.0]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.9.jar:6.0.9]
2.$Proxy262.exampleQuery(Unknown Source) ~[?:?]

Metadata

Metadata

Assignees

Labels

in: query-parserEverything related to parsing JPQL or SQLstatus: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions