Any help is highly appreciated!
Hibernate 6 detect the result of unaccent as a Object and not a String, meaning that we can not do LIKE on it…
@Query(value = “SELECT myentity FROM MyEntity myentity WHERE unaccent(LOWER(myentity.name)) like CONCAT(‘%’, :name, ‘%’)”)
List searchByName(String search);
Spring boot 3.2 + postgresql-13.2-1
SemanticException: Operand of 'like' is of type 'java.lang.Object' which is not a string (it is not an instance of 'java.lang.String' or 'char[]')
SemanticException: Operand of 'like' is of type 'java.lang.Object' which is not a string (it is not an instance of 'java.lang.String' or 'char[]')
... 31 common frames omitted
Caused by: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: Operand of 'like' is of type 'java.lang.Object' which is not a string (it is not an instance of 'java.lang.String' or 'char[]')
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:143)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:167)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:173)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:802)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:707)
at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:132)
at jdk.internal.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360)
at jdk.proxy4/jdk.proxy4.$Proxy204.createQuery(Unknown Source)
at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:94)
1. List item
Save EditClose