0
我想创建一个对象并保存ionto数据库插入jsonb到PostgreSQL的
Log l = new Log();
l.setTimestamp("creation_date", Util.getCurrentTimestamp());
l.setString("app_name", "name");
l.setString("log_type", "type");
l.setLong("user_id", 9l);
l.setLong("module_element_id", 9);
l.set("info", JsonHelper.toJsonString("{}"));
l.save();
我试过多发silution但总是收到此错误:
ERROR: column "info" is of type jsonb but expression is of type character varying
如何插入jsonb ?
编辑(DDL):
- 表:public.log
- DROP TABLE public.log;
CREATE TABLE public.log
(
id bigint NOT NULL DEFAULT nextval('log_id_seq'::regclass),
creation_date timestamp without time zone,
app_name text,
log_type text,
user_id bigint,
module_element_type bigint,
info jsonb,
CONSTRAINT log_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.log
OWNER TO postgres;
罗尼,你能否为你的桌子提供一个DDL? – ipolevoy
当然,我编辑了我的帖子 – Rony
Rony,我认为这个功能需要添加到PostgreSQL方言中,并且与https://github.com/javalite/activejdbc/issues/640相关。我试图找到Postgres文档,其中列出了所有具有这种奇怪语法的类型,但无法找到它。如果你发现,我会用它来将这个特性添加到框架中。 – ipolevoy