Skip site navigation (1) Skip section navigation (2)

Re: Mapping Hibernate boolean to smallint(Postgresql)

From: stagirus <mamasa(at)stagirus(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Mapping Hibernate boolean to smallint(Postgresql)
Date: 2010-09-25 19:31:55
Message-ID: 1285443115092-2853928.post@n5.nabble.com (view raw or flat)
Thread:
Lists: pgsql-bugs
As a fundamental protocol, I prefer to keep any "attitudes" and
"finger-pointing" off the table. Let us just focus on the real
problem-solving.

Though I am very versatile in speaking languages like C, C++ and Java, I
assumed we all can speak and understand "English." You can also clearly see
the issue on table is complicated. It spans Java, Hibernate, JDBC Drivers,
RDBMS Engines and and finally people.

Yes, the error is like - column "y" is of type integer but expression is of
type boolean. I just expressed it in natural language "type mismatch."
Below is the sample HBM file block.
		<property name="deleted" type="boolean">
			<column name="DELETED" />
		</property>
In the DB, DELETED column is SMALLINT but in the Java(POJOs), it is boolean. 

I like Dean's suggestion about "hibernate.query.substitutions." But does it
really solve the issue? The current code (HBM mapping) is fully functional
with Oracle (SMALLINT). 

That leaves us only two variables in the equation:
1. PostgresQL JDBC Driver
2. PostgresQL DB Engine.
 
During my research on your JDBC discussion forum, I learned that JDBC team
is mapping Java boolean to BIT or chars. Please refer this discussion.
http://postgresql.1045698.n5.nabble.com/Wrong-SqlType-for-boolean-columns-td2256874.html#a2256874

Please refer to the following data type mapping between Java types and SQL
types.
Oracle:
http://download.oracle.com/javase/1.3/docs/guide/jdbc/getstart/mapping.anc1.gif
DB2:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvjdata.htm
 
Is there any similar mapping reference for PostgresQL data types? (Seems
this question was already raised and successfully ignored!)
http://postgresql.1045698.n5.nabble.com/PostgreSQL-types-and-Java-types-td2174117.html

ARE THERE ANY ALTERNATIVE (3rd-party) JDBC DRIVERs FOR POSTGRESQL? In this
day & age compatibility with Hibernate got to be a key goal for any RDBMS.

thanks.

-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/Mapping-Hibernate-boolean-to-smallint-Postgresql-tp2853280p2853928.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

In response to

pgsql-bugs by date

Next:From: Peter EisentrautDate: 2010-09-25 19:38:38
Subject: Re: libpq: system-wide root.crt
Previous:From: Kirill SimonovDate: 2010-09-25 18:33:16
Subject: LEFT OUTER JOIN sub-SELECT produces a column != NULL when all NULLs are expected

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group