I hope that the forum had a great Christmas.
As a further update I just specified the following JPA annotation for one of my
java.util.Date columns:
Code:
@Column(columnDefinition="timestamp with time zone")
...and presto, my date was persisted as one would expect i.e. as a UTC value.
This is the functionality that I desire for all of my properties declared as a
java.util.Date - by default.
Would subclassing PostgreSQLDialect and replacing:
Code:
registerColumnType( Types.TIMESTAMP, "timestamp" );
with:
Code:
registerColumnType( Types.TIMESTAMP, "timestamp with time zone" );
and then pointing my
hibernate.dialect property to my subclass be the correct way to achieve my goal?
Also is there a reason why Oracle and Postgres shouldn't now register timestamps as "timestamp with time zone" always given their adherence to the SQL standard? As mentioned before,
java.util.Date represents a UTC time and so does "timestamp with time zone". Is there something I'm missing here or should I submit a change request for Hibernate in this respect?
Thanks for your attention.