Bug HHH-8697 seems to be alive in Spring Boot 3.0.4 with Hibernate 6.1.7 only in reverse.
I wrote a very simple SQL in a JPA repo and I am wondering that it does not work:
{noformat}@Query("SELECT a FROM #{#entityName} a WHERE ((:#{#iValue} IS NULL AND a.value IS NULL) OR a.value = :#{#iValue})") MyEntity findByValue(@Param("iValue") MyDataType value) {noformat}
and get the error message:
{noformat}Could not determine recommended JdbcType for org.example.MyDataType {noformat}
I have now found out that it is based on the check with NULL and the value is not NULL.
That means the upper query works without the error message if {{value == null}}. If {{value != null}}, the above error message comes.
EDIT:
I found a working solution, without #{#…} works like a charm:
{noformat}@Query("SELECT a FROM #{#entityName} a WHERE ((:iValue IS NULL AND a.value IS NULL) OR a.value = :iValue)") MyEntity findByValue(@Param("iValue") MyDataType value){noformat} |
|