Currently I have a Spring application with some resources that receives different kinds of data. One of the data attributes its a Timestamp and the value is sent in the request. I am using Spring Data Jpa to persist the data in a Postgresql database.
This is how I have my object:
@JsonProperty(value = "control_initial_timestamp")
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@Column(name = "ctrl_init_ts")
private Date controlInitTimestamp;
... Setters and Getters ...
My Request looks like this:
"record_insert_timestamp" : "2020-05-18 09:53:24.475"
In the database I receive this: 2020-05-18 05:53:24.475000 If you noticed, it changes the time of the whole timestamp.
Also, with Spring Data, all I am doing is object.save(objectlist); I am not doing any specially query.
Please let me know if I am missing anything.
Thanks,
control_initial_timestampin place ofrecord_insert_timestamp?record_insert_timestampits just the name of the attribute in my json requets body. It doesn't have to do anything with what is actually happening with the value.