I have a Postgres DB, with a column named t_time of type timestamp with time zone.
When I use the psql tool to see the contents of the column, I get, for example:
select t_time from table1 where ...
t_time
---------------------
2011-02-28 14:09:25
2011-02-28 14:09:23
This is the format I want.
However, when I run the same select query through my Java code, which uses Hibernate, I get the following:
2011-02-28 14:09:25.0
2011-02-28 14:09:23.0
As you can see, at the end a dot and a zero are added.
My question is - how do I specify the format I want to use?
Changing the query, for example like this,
select to_char(t_time, 'YYYY-MM-DD HH24:MI:ss') as t_time from table1 where ...
is possible, but less desired since I have a few places in the code that query for the data and I do not wish to change each of them, I would like the definition to be system-wide.
Thanks for your help.
EDIT:
I wanted to add a clarification: When I wrote this, I was thinking of the direction of editing the mapping file. I thought that there might be a way to define the format there. That would mean changing in one place only, and not relying on any default format.
Thanks.
Timestamp.