问题描述
我需要更新jsonb Array列(在数组中添加或删除元素),我在春季启动时使用了Emf的本机查询。
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 (将#修改为@)