Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql)
От | Oliver Jowett |
---|---|
Тема | Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql) |
Дата | |
Msg-id | 4CA28CCB.5020400@opencloud.com обсуждение исходный текст |
Ответ на | Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql) (stagirus <mamasa@stagirus.com>) |
Ответы |
Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql)
|
Список | pgsql-jdbc |
stagirus wrote: > You have already noted above that boolean values and integer values are > interchangeable as per the JDBC 4.0 Spec. They're not actually - see my post. You can ask the driver to convert between types for you, but Hibernate does not appear to be doing that (presumably because you've told it that the column is a boolean, which doesn't match your DDL!) To repeat my suggestions: * use a real boolean column in their schema (I mean, the data you're representing IS a boolean value in this case, right?); or * use setObject(column, value, Types.SMALLINT) instead of the implied setBoolean() call when setting the column (this may be tricky to do since you have a layer between you and the driver, but that's not really the driver's fault..); or * add a suitable implicit cast on the backend side from boolean -> smallint (not sure if this works, haven't looked at the details) Do any of these work for you? The first suggestion seems to be the simplest to me, since you really are storing a boolean, not a smallint, and you have control over the DDL. -O
В списке pgsql-jdbc по дате отправления: