I have a spring boot application that uses spring data jpa, hibernate and data is stored in MySQL. I have set the timezone to UTC using spring.jpa.properties.hibernate.jdbc.time_zone=UTC
. The date property is defined as following in the model entity class
@NotNull
@Column(nullable = false)
@Temporal(TemporalType.DATE)
private Date startDate;
So if I am passing date as "startDate": "2019-10-05"
in my Rest API, the date value is stored as "2019-10-04" in the database. I want the Date to be stored as "2019-10-05". I want the timezone conversion to be applied only for timestamp fields ? is it possible?
Edit: The issue for me is the data is getting converted to UTC. But I only want Objects with TimeStamp to be converted to UTC and not the date Objects