Java 使用postgres函数时出错;“较低”;在JPA命名查询中
知道hibernate为什么抱怨打字吗?我已经将字符串传递给函数。我正在使用带有命名参数的@Query语法。在查询中嵌入较低的函数可以吗 源代码:Java 使用postgres函数时出错;“较低”;在JPA命名查询中,java,postgresql,hibernate,spring-data-jpa,Java,Postgresql,Hibernate,Spring Data Jpa,知道hibernate为什么抱怨打字吗?我已经将字符串传递给函数。我正在使用带有命名参数的@Query语法。在查询中嵌入较低的函数可以吗 源代码: @Query("from UserEntity t where lower(t.email) = lower(:email)") List<UserEntity> findByEmail(@Param("email") String email); 相关链接: 我终于明白发生了什么事。我得到这个错误是因为当我调用函数findByEmai
@Query("from UserEntity t where lower(t.email) = lower(:email)")
List<UserEntity> findByEmail(@Param("email") String email);
相关链接:
我终于明白发生了什么事。我得到这个错误是因为当我调用函数
findByEmail
时,在某些情况下,电子邮件是null
,这导致发帖者抱怨。在调用此函数之前,我只需要检查null
。感谢@akshar patel的帮助。我终于明白发生了什么。我之所以会出现错误,是因为当我调用函数findByEmail时,在某些情况下,email为null,这导致了问题您刚刚从@raym ag的应答中复制了第一部分。我们可以检查函数中的null
值吗?我的意思是在函数中,而不是在调用之前。
Caused by: org.postgresql.util.PSQLException: ERROR: function lower(bytea) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Position: 899
nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet