【问题标题】:How to store Arraylist data in postgresql如何在 postgresql 中存储 Arraylist 数据
【发布时间】:2021-12-03 22:56:14
【问题描述】:

我正在尝试将 Arraylist<String> 写入 postgresql。但低于错误。

ERROR: column "data" is of type character varying[] but expression is of type bytea
  Hint: You will need to rewrite or cast the expression.

如果有人知道我应该使用哪种数据类型作为列在 postgresql 中存储 arraylist 内容?

谢谢

【问题讨论】:

  • 您可以将列定义为 bytea 数据类型
  • 嘿,在这种情况下,列值显示为[binary data]。仍然看不到内容

标签: java postgresql spring-boot jdbc


【解决方案1】:

你在使用 JPA、Spring Data 吗?

你查过@ElementCollection吗?我认为这会有所帮助。

Java JPA ElementCollection Doc

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 2016-07-17
  • 2012-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-15
  • 1970-01-01
  • 2013-09-04
相关资源
最近更新 更多