Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql)

From: Jeff Hubbach <Jeff(dot)Hubbach(at)cha(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql)
Date: 2010-10-05 16:03:34
Message-ID: 0FEDB42A-1C93-411C-853B-6CC27A4FBE44@cha.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc

I found this post in Hibernate's forums:

https://forum.hibernate.org/viewtopic.php?f=1&t=944165&p=2247802&hilit=postgres+boolean+smallint#p2247802

In summary, Hibernate will handle converting a char(1) in the database to/from boolean in java, and from that post, it works in DB2 and PostgreSQL.

So here's another option. Change your smallint in the database to a char(1). The only thing it affects is the DDL for each database, any existing data you have in the database, and the Hibernate mapping files. Your java code remains untouched.

-- Jeff Hubbach

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alan T DeKok 2010-10-05 17:11:21 Re: BUG #5687: RADIUS Authentication issues
Previous Message Xiaohui Xue 2010-10-05 15:56:17 BUG #5694: Postgres ODBC SQLTables is not working correctly

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tim 2010-10-05 22:06:17 JDBC type mappings
Previous Message Oliver Jowett 2010-10-05 11:05:27 Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql)