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