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 <[EMAIL PROTECTED]> 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
