I’m upgrading my spring version to 3.2.2 but got a issue when run the application. I have a query that is using a Like operand in a column with long values in a Oracle databse.
@Query(value = "SELECT c FROM Company c WHERE id LIKE :id || ‘%’ AND " +
“name LIKE :name%”)
Page findByIdAndName(Pageable pageable, Long id, String name);
I got this error:
org.hibernate.query.SemanticException: Operand of ‘like’ is of type ‘java.lang.Long’ which is not a string (it is not an instance of ‘java.lang.String’ or ‘char’)
The exception is pretty self explanatory. The like predicate only works on string types, but your id attribute is of type Long. I don’t know why you would want to do a query like this, but if you really must, then use an explicit cast WHERE cast(id as String) like :id ||'%' ...
Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.