pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Sunil.Vishnubhotla@gwinnettcounty.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: 8.x driver with EJB CMP
Date: Wed, 08 Jun 2005 09:42:14 +1200
Message-ID: <42A614B6.3020408@opencloud.com> (raw)
In-Reply-To: <4F61EAB5B670854A80F7365549454E160157AB0D@jacexchange02.gc.gov>
References: <4F61EAB5B670854A80F7365549454E160157AB0D@jacexchange02.gc.gov>

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



view thread (4+ messages)  latest in thread

Message-ID: <42A614B6.3020408@opencloud.com>
Permalink:  ../42A614B6.3020408@opencloud.com/
Also on:    postgresql.org/message-id/42A614B6.3020408@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, Sunil.Vishnubhotla@gwinnettcounty.com
  Subject: Re: 8.x driver with EJB CMP
  In-Reply-To: <42A614B6.3020408@opencloud.com>
  References: <4F61EAB5B670854A80F7365549454E160157AB0D@jacexchange02.gc.gov> <42A614B6.3020408@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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