简体   繁体   中英

java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...'

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?

肯定是一个MYSQL错误...更多信息可以在http://bugs.mysql.com/bug.php?id=59456上看到

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

@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.

It is not necessary a bug. You may try store this object as a blob. Which is a data type in eg mysql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM