geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianny Damour <gianny.dam...@optusnet.com.au>
Subject Re: FindByPrimaryKey
Date Thu, 06 Apr 2006 12:30:45 GMT
Hi,

I think that the current mapping capabilities are sufficient to support 
your case without any specific update (approach number 2.); or, you can 
change the type of the CMP field, in your EntityBean, to be 
java.sql.Timeestamp (approach number 1.). I think that the simplest 
approach is to change the CMP field type to Timestamp.

Thanks,
Gianny

Olivier Voutat wrote:

> Sorry, I think that I wasn't clear enough.
>
> My database column <startdate> in PostGreSql is TimeStamp.
>
> In my application I'm sending an object that has an attribute 
> <startdate> of type String in the format 'yyyy-mm-dd hh:mm:ss'
>
> Should I use another type for the attribute ?
>
> Best regards,
> Olivier Voutat
>
> On 4/6/06, *Gianny Damour* <gianny.damour@optusnet.com.au 
> <mailto:gianny.damour@optusnet.com.au>> wrote:
>
>     Hello Olivier,
>
>     You can do two things to fix this problem:
>
>     1. you can change the type of this field from String to Timestamp. I
>     think that this would be my preferred approach.
>
>     2. you can register a TypeConverter for this field such that the
>     String
>     is converted into a timestamp prior to be sent to the database. This
>     requires a more complex mapping configuration and the
>     implementation of
>     a TypeConverter. Basically, you will need a mapping like this for
>     your
>     field:
>
>       <cmp-field-name>timestamp</cmp-field-name>
>       <table-column>datainicio</table-column>
>       <sql-type>TIMESTAMP</sql-type>
>       <type-converter>full class name of your custom
>     TypeConverter</type-converter>
>
>     Thanks,
>     Gianny
>
>
>     Olvier Voutat wrote:
>
>     > Great, another problem, how do I do to insert a timestamp value in
>     > Postgres ? I'm sending it like a String to a timestamp field but
>     > Geronimo is complaining about the format. I'm sending like that :
>     > 'yyyy-mm-dd hh:mm:ss'.
>     >
>     > 01:06:10,272 WARN  [GeronimoConnectionEventListener]
>     > connectionErrorOccurred called with null
>     > org.postgresql.util.PSQLException: ERROR: column "datainicio" is of
>     > type timestamp without time zone but expression is of type character
>     > varying
>     >         at
>     > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
>     (QueryExecutorImpl.java:1512)
>     >         at
>     >
>     org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
>     >
>
>
>
>
>
>
> -- 
> Olivier Jeanpierre Voutat
> Rua Praia de Muriú, 9188
> Cep 59092-390 / Natal - RN
> Tel: (84) 3219-0427 Cel: (84) 9977-3917 




Mime
View raw message