Re: JBoss w/int8 primary keys in postgres ...

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: JBoss w/int8 primary keys in postgres ...
Дата
Msg-id 20030906222528.GD6486@opencloud.com
обсуждение исходный текст
Ответ на JBoss w/int8 primary keys in postgres ...  (James Robinson <jlrobins@socialserve.com>)
Ответы Re: JBoss w/int8 primary keys in postgres ...
Список pgsql-jdbc
On Sat, Sep 06, 2003 at 02:38:40PM -0400, James Robinson wrote:

> Is there any hope to get JBoss + PG JDBC to do this typecasting
> automatically? Assuming JBoss is using PreparedStatements for its dirty
> work, could the setLong() method on the JDBC driver's PreparedStatement
>  implementation possibly always punch in the trailing '::int8' ?

Something like this was tried without much success. See:

  http://archives.postgresql.org/pgsql-jdbc/2002-10/msg00163.php

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java#rev1.6

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java#rev1.12

Reading that thread, the change that was tried was quoting the value to get
an implicit cast from 'text' to the expected type -- whatever it was --
happening.

Perhaps it's reasonable to have setLong() always append ::int8 since that
does reflect the possible range of the parameter's type -- anyone more
familiar with this area want to comment? I guess that you end up with the
reverse problem of things that expect an int4 value but use setLong() will
break, but maybe that is less common and is going to have other problems
anyway if you try to use a java long that's larger than int4 can handle ..

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: JBoss w/int8 primary keys in postgres ...
Следующее
От: Paul Thomas
Дата:
Сообщение: Re: JBoss w/int8 primary keys in postgres ...