Home > Archive > PostgreSQL JDBC > April 2005 > Re: smallint vs. boolean (was invalid string enlargement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: smallint vs. boolean (was invalid string enlargement
Glenn Holmer

2005-04-12, 1:24 pm

On Fri, 2005-03-18 at 09:37 +1300, Oliver Jowett wrote:
> Glenn Holmer wrote:
>
>
> Without more details I'd have to say this is a hibernate or schema
> mapping bug -- it looks like it is using setBoolean() where you should
> be using setShort() (or vice versa). This only shows up in newer drivers
> because they more tightly bind types to parameters (due to using the V3
> extended query protocol to pass parameters to the server)
>
> This behaviour is unlikely to change, so you might want to look at
> tracking down the cause. As a last resort, you might be able to create
> implicit casts between smallint<->boolean.


Yes, the database has some fields defined as smallint and set to 0 for
false or either 1 for true; the Hibernate DTOs have these fields
declared as boolean.

Is there any way around this without rewriting everything?

--
____________________
____________________
____________________

Glenn Holmer gholmer@weycogroup.com
Software Engineer phone: 414-908-1809
Weyco Group, Inc. fax: 414-908-1601



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Oliver Jowett

2005-04-12, 8:24 pm

Glenn Holmer wrote:
> On Fri, 2005-03-18 at 09:37 +1300, Oliver Jowett wrote:


>
>
> Yes, the database has some fields defined as smallint and set to 0 for
> false or either 1 for true; the Hibernate DTOs have these fields
> declared as boolean.
>
> Is there any way around this without rewriting everything?


Change the column type so it is a boolean, change the hibernate mapping
so it calls setShort(), or create the implicit cast as I suggested.

-O

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com