0

If server is in India - storing timestamps value in IST. When run server from US - storing timestamps value in EST. I am using oracle database and hibernate 4.0.

Please suggest me how to get around this discrepancies.

I referred below links.

How can I get the current date and time in UTC or GMT in Java?

Hibernate TypeResolver

How to store date/time and timestamps in UTC time zone with JPA and Hibernate

Hibernate force timestamp to persist/load as UTC

Java, Hibernate, MySQL - store UTC date-time

Community
  • 1
  • 1
Rupesh Deo
  • 21
  • 4

2 Answers2

0

We can use "-Duser.timezone=US/Eastern" property to start server in any time zone.

Rupesh Deo
  • 21
  • 4
0

Since Hibernate 5.2, you can now force a custom time zone that might differ from the JVM one through the following configuration property:

<property name="hibernate.jdbc.time_zone" value="US/Eastern"/>

For more details, check out this article.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911