-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping character(2) with Postgres
PostPosted: Wed Jan 16, 2008 10:32 pm 
Regular
Regular

Joined: Fri Feb 09, 2007 3:47 pm
Posts: 56
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.