1
我已经为某些常用搜索功能实现了以下JPA存储库查询。 但与该查询,由于年龄是一个整数值和映射参数是字符串值我有一些例外如下。有没有什么机制可以隐式地将参数转换为相关的数据类型,而不是我们这样做。谢谢。Spring数据JPA存储库查询 - 如何将@Param值映射到多个参数类型
查询与通用参数
@Query("select u from User u where u.firstname = :searchText or u.age = :searchText")
List<User> findBySearchText(@Param("searchText") String searchText);
异常
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
亲爱的奥利弗,非常感谢值得完整解释。玩得开心!谢谢。 – Channa