Search code examples
javamysqljpasqlexception

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?


Solution

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