postgresql – 在光滑,scala中处理Postgres json数据类型
发布时间:2020-12-13 18:06:52 所属栏目:百科 来源:网络整理
导读:我的架构中有一个Postgres’json’列. 这是我的代码中的列映射: def my_col = column[Option[String]]("my_col") 哪个不起作用,插入时得到的堆栈跟踪说: column “my_col” is of type json but expression is of type character varying 我也试过这个: d
我的架构中有一个Postgres’json’列.
这是我的代码中的列映射: def my_col = column[Option[String]]("my_col") 哪个不起作用,插入时得到的堆栈跟踪说:
我也试过这个: def my_col = column[Option[String]]("my_col",O.SqlType("json")) 这也产生相同的错误.
问题是java / scala中没有标准的json数据类型.
所以你需要写’包装’. 通过以下链接,作者在数据库级别上处理了json: http://www.pateldenish.com/2013/05/inserting-json-data-into-postgres-using-jdbc-driver.html (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |