2

I'm quite fresh in Hibernate, I just have run my first project with Hibernate.

But I want to insert some data in my Postgres DB, one of the column is operationtime TIMESTAMP WITH TIME ZONE , while I was doing this with Postgres I was using current_timestamp(0) to insert date. Wondering how to proceed in hibernate in order to insert date. How to do the map in my map XML file.

For example:

  <property name="time" type="java.util.Date">
    <column name="operationtime"/>
  </property>

I did some research but I wasn't able to find what I want, probably I'm missing something regarding date types in Hibernate. Any advice is welcome.

Yuri
  • 4,254
  • 1
  • 29
  • 46
Brake
  • 21
  • 1
  • 2
  • Storing a timestamp with time zone in a database is generally not advisable: http://derickrethans.nl/storing-date-time-in-database.html – Denis de Bernardy May 13 '11 at 12:16

1 Answers1

1

This code shows how to map a date/timestamp and to persist it. Have a look

stratwine
  • 3,663
  • 2
  • 26
  • 32