如何解决在springboot中更新PSQL的本机查询ERROR o.h.e.jdbc.spi.SqlExceptionHelper-错误:运算符不存在:jsonb-bytea
我需要更新jsonb Array列(在数组中添加或删除元素),我在春季启动时使用了Emf的本机查询。
查询-从数组中删除元素(“测试数据”)(直接在DB上运行)
UPDATE my-table SET label_array = label_array - 'test-data' WHERE uuid in id =1;
列定义-
@Column(columnDefinition = "jsonb",name="label_array")
@Basic(fetch = FetchType.LAZY)
private List<String> label_array;
我无法通过代码运行此查询。任何帮助,暗示,工作安排均应适用。 请帮忙。 错误-
03:19:57.477 [http-nio-8085-exec-2] WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 0,SQLState: 42883
03:19:57.477 [http-nio-8085-exec-2] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ERROR: operator does not exist: jsonb - bytea
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Position: 53
03:19:57.484 [http-nio-8085-exec-2] ERROR o.z.p.spring.common.AdviceTraits - Internal Server Error
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement
我也尝试过使用cast
方法to_jsonb
方法直接在DB上运行,而不是在spring上运行。
我的方言org.hibernate.dialect.PostgreSQL10Dialect
不支持jsonb
尝试创建自定义方言也没有帮助。
来自:https://thorben-janssen.com/persist-postgresqls-jsonb-data-type-hibernate/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。