pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedJDBC Driver can't read UUID from database
4+ messages / 2 participants
[nested] [flat]
* JDBC Driver can't read UUID from database
@ 2012-06-05 23:26 Dean Schulze <dschulze@knowledgefactor.com>
0 siblings, 1 reply; 4+ messages in thread
From: Dean Schulze @ 2012-06-05 23:26 UTC (permalink / raw)
To: pgsql-bugs
I'm using Hibernate (3.6 and 4.0) with Postgresql 9.1. Our tables have UUIDs in them and your driver is trying to convert UUIDs to longs:
Caused by: org.postgresql.util.PSQLException: Bad value for type long : dbada1e4-a165-4601-b34e-d08428cd81df
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toLong(AbstractJdbc2ResultSet.java:2796)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getLong(AbstractJdbc2ResultSet.java:2019)
at org.postgresql.jdbc4.Jdbc4ResultSet.getBlob(Jdbc4ResultSet.java:52)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBlob(AbstractJdbc2ResultSet.java:335)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(AbstractResultSetProxyHandler.java:104)
... 32 more
I've tried chaining the Hibernate annotations to treat them as Strings and CLOBs but I get the same exception.
Driver versions I've tried are 9.0-801.jdbc4 and 9.1-901.jdbc4
This is a show stopper.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: JDBC Driver can't read UUID from database
@ 2012-06-06 08:12 Kris Jurka <books@ejurka.com>
parent: Dean Schulze <dschulze@knowledgefactor.com>
0 siblings, 1 reply; 4+ messages in thread
From: Kris Jurka @ 2012-06-06 08:12 UTC (permalink / raw)
To: Dean Schulze <dschulze@knowledgefactor.com>; +Cc: pgsql-bugs
On Tue, 5 Jun 2012, Dean Schulze wrote:
>
> I'm using Hibernate (3.6 and 4.0) with Postgresql 9.1. Our tables have
> UUIDs in them and your driver is trying to convert UUIDs to longs:
>
This is a hibernate mapping problem, not a JDBC Driver problem. If you
have a plain ResultSet and call getString() on a UUID field, it will
certainly work. Mapping the UUID to BLOB or CLOB is incorrect. I'm not
sure why your attempt to map it to a String didn't work, but you are
not convincing Hibernate to use a plain getString call.
Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: JDBC Driver can't read UUID from database
@ 2012-06-11 02:43 Dean Schulze <dschulze@knowledgefactor.com>
parent: Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 4+ messages in thread
From: Dean Schulze @ 2012-06-11 02:43 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-bugs
Thanks.
Out of curiosity why didn't the driver map the Postgresql UUID to a Java
UUID?
On 6/6/12 2:12 AM, "Kris Jurka" <books@ejurka.com> wrote:
>
>
>On Tue, 5 Jun 2012, Dean Schulze wrote:
>
>>
>> I'm using Hibernate (3.6 and 4.0) with Postgresql 9.1. Our tables have
>> UUIDs in them and your driver is trying to convert UUIDs to longs:
>>
>
>This is a hibernate mapping problem, not a JDBC Driver problem. If you
>have a plain ResultSet and call getString() on a UUID field, it will
>certainly work. Mapping the UUID to BLOB or CLOB is incorrect. I'm not
>sure why your attempt to map it to a String didn't work, but you are
>not convincing Hibernate to use a plain getString call.
>
>Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: JDBC Driver can't read UUID from database
@ 2012-06-11 21:28 Kris Jurka <books@ejurka.com>
parent: Dean Schulze <dschulze@knowledgefactor.com>
0 siblings, 0 replies; 4+ messages in thread
From: Kris Jurka @ 2012-06-11 21:28 UTC (permalink / raw)
To: Dean Schulze <dschulze@knowledgefactor.com>; +Cc: pgsql-bugs
On Mon, 11 Jun 2012, Dean Schulze wrote:
> Out of curiosity why didn't the driver map the Postgresql UUID to a Java
> UUID?
>
The example I gave of calling getString must return a String and not
another type. With a recent JDBC Driver and Java version, calling
getObject will return a UUID object.
Kris Jurka
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2012-06-11 21:28 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 23:26 JDBC Driver can't read UUID from database Dean Schulze <dschulze@knowledgefactor.com>
2012-06-06 08:12 ` Kris Jurka <books@ejurka.com>
2012-06-11 02:43 ` Dean Schulze <dschulze@knowledgefactor.com>
2012-06-11 21:28 ` Kris Jurka <books@ejurka.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