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