pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
8.x driver with EJB CMP
4+ messages / 2 participants
[nested] [flat]

* 8.x driver with EJB CMP
@ 2005-06-07 18:37 Sunil.Vishnubhotla@gwinnettcounty.com
  2005-06-07 21:42 ` Re: 8.x driver with EJB CMP Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Sunil.Vishnubhotla@gwinnettcounty.com @ 2005-06-07 18:37 UTC (permalink / raw)
  To: pgsql-jdbc

 
Hi,

I am using JBoss 4.x with PosrgreSQL 8.x JDBC postgresql-8.0-311.jdbc3.jar. I have a CMP EJB that has a setter: 

void setCreationDate(java.sql.Date creationDate);

When I use the setter in my ejbCreate() call:

setCreationDate( new java.sql.Date( new java.util.Date().getTime() ) );

it throws an SQLException : Could not create entity:java.sql.SQLException: ERROR: column "creation_date" is of type date but expression is of type character varying.

What am i doing wrong ??
 
The same code works like a charm with 7.4x driver. 

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

* Re: 8.x driver with EJB CMP
  2005-06-07 18:37 8.x driver with EJB CMP Sunil.Vishnubhotla@gwinnettcounty.com
@ 2005-06-07 21:42 ` Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Oliver Jowett @ 2005-06-07 21:42 UTC (permalink / raw)
  To: Sunil.Vishnubhotla@gwinnettcounty.com; +Cc: pgsql-jdbc

Sunil.Vishnubhotla@gwinnettcounty.com wrote:

> I am using JBoss 4.x with PosrgreSQL 8.x JDBC
> postgresql-8.0-311.jdbc3.jar. I have a CMP EJB that has a setter:
> 
> void setCreationDate(java.sql.Date creationDate);
> 
> When I use the setter in my ejbCreate() call:
> 
> setCreationDate( new java.sql.Date( new java.util.Date().getTime() ) );
> 
> it throws an SQLException : Could not create
> entity:java.sql.SQLException: ERROR: column "creation_date" is of type
> date but expression is of type character varying.
> 
> What am i doing wrong ??

I guess that the JBoss CMP layer is using setString() instead of
setDate() (or setObject(..., Types.VARCHAR) not setObject(...,
Types.DATE)) to set the parameter in question. I'm not familiar with the
JBoss CMP layer, but can you configure it to use setDate() / Types.DATE?
Alternatively, change your schema to have creation_date as a text type.

-O



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

* Re: 8.x driver with EJB CMP
@ 2005-06-08 12:56 Sunil.Vishnubhotla@gwinnettcounty.com
  2005-06-08 22:51 ` Re: 8.x driver with EJB CMP Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Sunil.Vishnubhotla@gwinnettcounty.com @ 2005-06-08 12:56 UTC (permalink / raw)
  To: oliver@opencloud.com; +Cc: pgsql-jdbc

Thanks O,

The same code works like a charm when I revert back to 7.4x JDBC driver with PGSql 8.x. Could it be the way the 8.x drivers are implemented?

Thanks,

-----Original Message-----
From: Oliver Jowett [mailto:oliver@opencloud.com]
Sent: Tuesday, June 07, 2005 5:42 PM
To: Vishnubhotla, Sunil
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] 8.x driver with EJB CMP

Sunil.Vishnubhotla@gwinnettcounty.com wrote:

> I am using JBoss 4.x with PosrgreSQL 8.x JDBC
> postgresql-8.0-311.jdbc3.jar. I have a CMP EJB that has a setter:
>
> void setCreationDate(java.sql.Date creationDate);
>
> When I use the setter in my ejbCreate() call:
>
> setCreationDate( new java.sql.Date( new java.util.Date().getTime() ) );
>
> it throws an SQLException : Could not create
> entity:java.sql.SQLException: ERROR: column "creation_date" is of type
> date but expression is of type character varying.
>
> What am i doing wrong ??

I guess that the JBoss CMP layer is using setString() instead of
setDate() (or setObject(..., Types.VARCHAR) not setObject(...,
Types.DATE)) to set the parameter in question. I'm not familiar with the
JBoss CMP layer, but can you configure it to use setDate() / Types.DATE?
Alternatively, change your schema to have creation_date as a text type.

-O



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

* Re: 8.x driver with EJB CMP
  2005-06-08 12:56 Re: 8.x driver with EJB CMP Sunil.Vishnubhotla@gwinnettcounty.com
@ 2005-06-08 22:51 ` Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Oliver Jowett @ 2005-06-08 22:51 UTC (permalink / raw)
  To: Sunil.Vishnubhotla@gwinnettcounty.com; +Cc: pgsql-jdbc

Sunil.Vishnubhotla@gwinnettcounty.com wrote:

> The same code works like a charm when I revert back to 7.4x JDBC driver with PGSql 8.x. Could it be the way the 8.x drivers are implemented?

Yes, the 8.x drivers changed to make full use of the V3 protocol, which 
involves pushing parameter substitution to the backend. Previous drivers 
did textual substitution into the query, which had slightly different 
behaviour but limited what could be done in the way of streaming large 
parameter values and preserving query plans between executions.

-O



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


end of thread, other threads:[~2005-06-08 22:51 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-07 18:37 8.x driver with EJB CMP Sunil.Vishnubhotla@gwinnettcounty.com
2005-06-07 21:42 ` Oliver Jowett <oliver@opencloud.com>
2005-06-08 12:56 Re: 8.x driver with EJB CMP Sunil.Vishnubhotla@gwinnettcounty.com
2005-06-08 22:51 ` 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