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 10:29:02 GMT
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)
>  




Mime
View raw message