小编San*_*gam的帖子

如何使用 spring-data-jdbc 读取/写入 postgres jsonb 类型?

我尝试将以下内容与 spring-data-jdbc 和 postgres 驱动程序(kotlin)一起使用,

data class MyEntity(
  val id: UUID,
  val content: String
)
Run Code Online (Sandbox Code Playgroud)

使用字符串失败并出现以下错误,

org.postgresql.util.PSQLException: ERROR: column "content" is of type jsonb but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  Position: 31
Run Code Online (Sandbox Code Playgroud)

我不确定如何使用 String -> jsonb 转换器

postgresql jdbc spring-data spring-boot spring-data-jdbc

6
推荐指数
1
解决办法
1万
查看次数