org.hibernate.HibernateException: Wrong column type...Found: char, expected: varchar2  

Joined:
01/02/2012
Posts:
9

January 23, 2012 14:58:58    Last update: January 23, 2012 14:58:58
This exception occurs when the Java object attribute is of type String, while the database column is of type CHAR(n), and hibernate.hbm2ddl.auto is validate in persistence.xml.

There are two solutions:
  1. Add columnDefinition to the @Column annotation:
    @Column(name = STATE_CODE, columnDefinition = char)
    

  2. Remove hibernate.hbm2ddl.auto from persistence.xml.
Share |
| Comment  | Tags