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

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
Cc: James Robinson <jlrobins(at)socialserve(dot)com>, "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JBoss w/int8 primary keys in postgres ...
Date: 2003-09-09 13:38:41
Message-ID: 1063114720.67981.9.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> With the proposed modifications to the JDBC driver enabled
>
> PreparedStatement pstmt = con.prepareStatement("select name from test
> where id = ?");
> pstmt.setLong(1, 42);
> pstmt.executeQuery();
>
> would actually produce:
>
> select name from test where id = 42::int8

Silly question, but why don't you simply ensure any ?'s are quoted?

select name from test where id = '42'

This allows PostgreSQL to choose the best type for the job -- in this
case it will try to match that of id. It will work that way on all
older and newer versions of PostgreSQL.

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message João Ribeiro 2003-09-09 15:46:39 Re: JBoss w/int8 primary keys in postgres ...
Previous Message Paul Thomas 2003-09-09 13:32:08 Re: JBoss w/int8 primary keys in postgres ...