错误:列" xxxxxxx"是字符变量[],但表达式是bytea类型

时间:2016-09-07 05:26:46

标签: spring postgresql hibernate

我在Spring中遇到错误并使用db postgres

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

我的POJO有data_member,如:

@Column(name = "xxxxxxx")
private String[] xxxxxxx;

1 个答案:

答案 0 :(得分:0)

您可以实现hibernate UserType 界面, 然后将@Type注释添加到您的属性中。

示例:

@Column(name = "xxxxxxx")
@Type(type = "xx.xxx.xxx.YourImplementationOfUserType")
private String[] xxxxxxx;