pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Exception in Boolean to int2 conversion in xwiki??
2+ messages / 2 participants
[nested] [flat]

* Exception in Boolean to int2 conversion in xwiki??
@ 2005-10-10 05:22 Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
  2005-10-10 06:26 ` Re: Exception in Boolean to int2 conversion in xwiki?? Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Joost Kraaijeveld @ 2005-10-10 05:22 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

I get the following exception while using xwiki and PostgreSQL, which
originates in the PostgreSQL jdbc driver according to the stacktrace:

2005-10-10 06:03:24,657 ERROR [org.hibernate.util.JDBCExceptionReporter]
Batch entry 0 update xwikiclassesprop set XWP_PRETTYNAME=Skin,
XWP_CLASSTYPE=com.xpn.xwiki.objects.classes.StringClass,
XWP_UNMODIFIABLE=0, XWP_NUMBER=1 where XWP_ID=104408758 and
XWP_NAME=skin was aborted.  Call getNextException to see the cause.
2005-10-10 06:03:24,657 WARN  [org.hibernate.util.JDBCExceptionReporter]
SQL Error: 0, SQLState: 42804
2005-10-10 06:03:24,657 ERROR [org.hibernate.util.JDBCExceptionReporter]
ERROR: column "xwp_unmodifiable" is of type smallint but expression is
of type boolean

Does this mean that it is not possible to convert a Java Boolean to a
PostgreSQL int2 according to the driver or am I reading the exception
text wrong? 

If I am reading the exception text correct, doesn't the JDBC spec
specify a mapping from Boolean to smallint (according to Appendix B,
table B-5)?

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl 





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Exception in Boolean to int2 conversion in xwiki??
  2005-10-10 05:22 Exception in Boolean to int2 conversion in xwiki?? Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
@ 2005-10-10 06:26 ` Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Jowett @ 2005-10-10 06:26 UTC (permalink / raw)
  To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>; +Cc: pgsql-jdbc

Joost Kraaijeveld wrote:

> 2005-10-10 06:03:24,657 ERROR [org.hibernate.util.JDBCExceptionReporter]
> ERROR: column "xwp_unmodifiable" is of type smallint but expression is
> of type boolean

> Does this mean that it is not possible to convert a Java Boolean to a
> PostgreSQL int2 according to the driver or am I reading the exception
> text wrong? 

> If I am reading the exception text correct, doesn't the JDBC spec
> specify a mapping from Boolean to smallint (according to Appendix B,
> table B-5)?

Table B-5 says that you can do "setObject(n, new Boolean(value), 
Types.SMALLINT)" and the driver will convert the Boolean to a SMALLINT. 
See section 13.2.2.2 ("Type Conversions Using the Method setObject") in 
the spec.

As far as I know, the driver supports this case correctly.

I suspect that Hibernate is using setBoolean(), or passing a Boolean to 
the setObject() variant that does not take a Types constant. In both of 
these cases the driver will pass the parameter to the backend typed as a 
boolean, which will produce an error like the above if actually needs to 
be some other type.

-O



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-10-10 06:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-10 05:22 Exception in Boolean to int2 conversion in xwiki?? Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
2005-10-10 06:26 ` Oliver Jowett <oliver@opencloud.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox