I have a column in a Postgresql DB table defined as:
columnName character(2)
How do I map that with Hibernate?
I've tried a number of things, none of which work.
<property name="columnName " column="columnName" type="string" length="2" />
<property name="columnName " column="columnName" type="character" length="2" />
<property name="columnName " column="columnName" length="2" />
<property name="columnName " column="columnName" />
I get errors such as:
Initial SessionFactory creation failed.org.hibernate.HibernateException: Wrong column type: footnote, expected: varchar(2)
Initial SessionFactory creation failed.org.hibernate.HibernateException: Wrong column type: footnote, expected: varchar(2)
Initial SessionFactory creation failed.org.hibernate.HibernateException: Wrong column type: footnote, expected: varchar(255)
I have tried setting the type on my DAO class to String, char[], Character[], char, and Character. I can get it to work with char/Character, but this truncates the value from 2 characters to 1 character. I need the value to contain both characters.
I've read section "5.1.9. property" of the Hibernate documentation and plenty of search results, with no success result so far.
Can anyone offer some advice?
Thanks!
|