From: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
---|---|
To: | Oliver Jowett <oliver(at)opencloud(dot)com> |
Cc: | stagirus <mamasa(at)stagirus(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql) |
Date: | 2010-10-01 03:09:06 |
Message-ID: | 4CA550D2.8090407@postnewspapers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-jdbc |
On 10/01/2010 04:38 AM, Oliver Jowett wrote:
> This is not correct. I covered this in a previous mail.
[snip]
> So, in summary: If you explicitly ask for a Java boolean to be mapped to
> a JDBC SMALLINT, by passing Types.SMALLINT to setObject(), then that
> should be supported and the driver will do the conversion for you; if
> that doesn't work, that's a bug! However, if you don't specify a type
> when calling setObject() or setBoolean(), it is mapped to BOOLEAN. If
> BOOLEAN is then not a suitable type for the actual query you're trying
> to run, then you'll get a SQL error, but that's not the driver's fault,
> it just did what you asked!
Aah, thanks for the clarification. I didn't notice your earlier message
on the topic.
Given that, it's pretty clear that the OP has to fix their app to:
- Trust Hibernate to generate their DDL, taking care of their db
portability issues;
- Use per-database DDL with the data types Hibernate expects;
- Use a short in Java if they want a short in the database, and convert
it in their accessor methods; or
- Use a Hibernate UserType to call the appropriate set() and get() JDBC
methods, overriding the default type-based options in the dialect.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2010-10-01 03:21:13 | Re: BUG #5685: Installer Error |
Previous Message | Mark Kirkwood | 2010-10-01 02:43:17 | src/tools/fsync/test_fsync.c does not compile |
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2010-10-01 03:50:54 | Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql) |
Previous Message | stagirus | 2010-09-30 22:18:53 | Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql) |