问题描述
@Lob
@Column(name = "message")
private String message;
实体中的属性,即Postgres数据库中的blob数据类型,它存储为表中的bigint
(字节位置,我想是在db中)。
我已经为实体编写了JPA规范,其所有属性均正常工作。
if (!StringUtils.isEmpty(criteria.getMessage())) {
predicateList.add(cb.like(root.get("message"),"%" + criteria.getMessage() + "%"));
isFilterEmpty = false;
}
以上代码是表中message属性的规范说明,因为bigint
存储在表中,规范查询不会将bigint
转换为text(lo_get
posgres方法转换为原始文本值),它会使用bigint
值本身与like
进行比较,因此会引发错误。
Caused by: org.postgresql.util.PsqlException: ERROR: operator does not exist: text ~~ bigint
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
如何解决此问题?暂时我没有在规范中添加此过滤器,在获取数据后,我暗示着要根据消息进行过滤
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)