i have a Java Spring application with lots of queries, which so far have worked until spring boot 3.2.0.
Recently, after simply changing to spring boot 3.2.1, I started getting this kind of error:
org.hibernate.query.sqm.produce.function.FunctionArgumentException: Function argument [org.hibernate.query.sqm.tree.expression.SqmLiteralNull@5bd97ebe] of type [org.hibernate.query.sqm.tree.expression.NullSqmExpressible@3f8a721f] at specified position [2] in call arguments was not typed as an allowable function return type
My pom dependencies look like this:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
<relativePath />
</parent>
<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
My queries, with some code i cant disclose removed, but still giving errors, has simple conditions:
@Query("select org "
+ " from Organization org "
+ " where 1 = 1 "
+ " and ( "
+ " coalesce(:#{#request.name},null) is null "
+ " or "
+ " trim(:#{#request.name}) = '' "
+ " or "
+ " lower(org.name) like lower(trim(:#{#request.name}))"
+ " ) "
)
Page<Organization> getPageByCriteria(@Param("request") GetOrganizationsRequestDto request, Pageable pageable);
I am connecting to oracle database version 11g
Does anyone have this kind of problem or similar and can help me with it?
Thanks
Coalesce expected non-null parameters, so you should remove null
parameter.
Transform from your original method, it should be same with this:
select org from Organization org
where 1 = 1
and (:#{#request.name} is null
or trim(:#{#request.name}) = ''
or lower(org.name) like lower(trim(:#{#request.name}))
)