Re: JBoss w/int8 primary keys in postgres ... - Mailing list pgsql-jdbc

From Paul Thomas
Subject Re: JBoss w/int8 primary keys in postgres ...
Date
Msg-id 20030909143208.C3136@bacon
Whole thread Raw
In response to Re: JBoss w/int8 primary keys in postgres ...  (James Robinson <jlrobins@socialserve.com>)
Responses Re: JBoss w/int8 primary keys in postgres ...  (Rod Taylor <rbt@rbt.ca>)
List pgsql-jdbc
On 09/09/2003 01:57 James Robinson wrote:
>
> On Monday, September 8, 2003, at 10:18  AM, Paul Thomas wrote:
>
>> As the JDBC driver is designed to work for current + many past releases
>> of PG, modifications along the line I've proposed would also help users
>> of older versions of PG and provide fairly consistent behavior across
>> versions.
>
> I'm certainly not against such a proposal, making our PreparedStatements
> smarter, but it would not help out in the JBossCMP case, nor would it
> help out any other frontend, including the CLI psql client, in that:
>
> create table test (
>     pk int8 not null primary key,
>     name text;
> );
> copy into test values ( .... )
>
> ...
> select name from test where id = 42;
>
> just doesn't do what you would reasonably expect.

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

which _would_ cause an index to be used on your table.
>>> CMP will be the death of us all.
>>
>> No, just those who choose to go the EJB route. My preference is DAO.
>
> I am enslaved to entity beans for now, and am ignorant for the most part
> regarding the philosophies of both JDO and DAO. How would DAO get around
> this issue?

Take a look at the sample Adventure application on java.sun.com. It uses
DAOs.

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

pgsql-jdbc by date:

Previous
From: "Nick Fankhauser"
Date:
Subject: Re: postgres- connection refuse
Next
From: Rod Taylor
Date:
Subject: Re: JBoss w/int8 primary keys in postgres ...