openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alessandro Polverini (JIRA)" <>
Subject [jira] [Created] (OPENJPA-2382) Wrong handling of char property
Date Thu, 16 May 2013 18:27:15 GMT
Alessandro Polverini created OPENJPA-2382:

             Summary: Wrong handling of char property
                 Key: OPENJPA-2382
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 2.2.2
         Environment: Spring 3.2.1
spring-data-jpa 1.3.0
mysql 5.5.31
            Reporter: Alessandro Polverini

I have an entity with a property defined in this way:

  @Column(name = "type", columnDefinition = "char")
  private char type = 'C';

The column definition in the mysql table is char(1) and when I try to persist the entity I
got an error saying that the column is not wide enough and the data would be truncated.

I then changed to column from char to varchar(10) and I discovered that openjpa is saving
the ascii code of the char in the column instead of the char itself.

So for example I had a '67' value instead of 'C'.

The same program runs perfectly fine with Hibernate.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message