rajadilipkolli
rajadilipkolli

Reputation: 3601

How to persist date data in given timezone

When using Hibernate only application using property like hibernate.jdbc.time_zone helps me to save all date formats in my desired timezone example UTC.

How to achieve the same using spring boot jpa with minimal or no code change? Is there some property to add in application.properties

Upvotes: 1

Views: 500

Answers (3)

Neonailol
Neonailol

Reputation: 117

In your application.properties you can specify Hibernate properties by prefixing them with spring.jpa.properties. like this:

spring.jpa.properties.hibernate.jdbc.time_zone=UTC

Upvotes: 1

luboskrnac
luboskrnac

Reputation: 24591

You can configure Jackson timezone for deserialization via this configuration:

spring.jackson.time-zone=UTC

Upvotes: 0

Alexander.Furer
Alexander.Furer

Reputation: 1869

By adding hibernate as your jpa implementation, then you can define provider specific settings in configuration file.

Upvotes: 0

Related Questions