java.sql。SQLException:错误的串值:“只\xAC\ x00\x05sr…”

时间:2021-08-09 22:48:19

I have code looking like that:

我的代码是这样的:

    @Column(name = COLUMN_DESCRIPTION, columnDefinition = "LONGTEXT")
private Map<Locale, String> description = new HashMap<>();

after trying to add something to column i got

在尝试添加一些东西到列我得到

java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'description' at row 1

Where's the problem?

问题在哪里?

2 个解决方案

#1


2  

Surely it is a MYSQL Bug ... More can be seen at http://bugs.mysql.com/bug.php?id=59456

这肯定是一个MYSQL错误……更多信息请参见http://bugs.mysql.com/bug.php?id=59456

#2


2  

I've solved it so here it is, maybe someone find it useful:

我已经解出来了,也许有人觉得它有用:

I tried to use columnDefinition = "LONGTEXT" in wrong place. There's only reference to table ProductLocalization, where mulitilingual descriptions are stored. When I used

我试图在错误的地方使用columnDefinition = "LONGTEXT"。只有对表产品本地化的引用,其中存储多语描述。当我使用

@ManyToOne
@JoinColumn(name = AbstractLocalizingEntity.COLUMN_RELATED_ENTITY, nullable = false)
private Product entity;

@Column(name = Product.COLUMN_DESCRIPTION, columnDefinition = "LONGTEXT")
private String description;

in ProductLocalization class it started working fine. Thanks all for your help.

在产品本地化类中,它开始正常工作。谢谢大家的帮助。

#1


2  

Surely it is a MYSQL Bug ... More can be seen at http://bugs.mysql.com/bug.php?id=59456

这肯定是一个MYSQL错误……更多信息请参见http://bugs.mysql.com/bug.php?id=59456

#2


2  

I've solved it so here it is, maybe someone find it useful:

我已经解出来了,也许有人觉得它有用:

I tried to use columnDefinition = "LONGTEXT" in wrong place. There's only reference to table ProductLocalization, where mulitilingual descriptions are stored. When I used

我试图在错误的地方使用columnDefinition = "LONGTEXT"。只有对表产品本地化的引用,其中存储多语描述。当我使用

@ManyToOne
@JoinColumn(name = AbstractLocalizingEntity.COLUMN_RELATED_ENTITY, nullable = false)
private Product entity;

@Column(name = Product.COLUMN_DESCRIPTION, columnDefinition = "LONGTEXT")
private String description;

in ProductLocalization class it started working fine. Thanks all for your help.

在产品本地化类中,它开始正常工作。谢谢大家的帮助。