I have a little problem with mysql + hibernate. in the database I have:
I don’t have any record of January 13th 2023
if I perform a query to get this information of the January 14th 2023, in the code I get this:
I don’t know why if in the database I have 14-jan-23 in the code I get: 13-jan-23 18:00:00
I thing that it’s a configuration problem, in the hibernate.cfg.xml I have:
<property name="connection.url">jdbc:mysql://localhost:3306/metsa?serverTimezone=UTC</property>
any one knows what I have wrong?
I tried to change the time zone in mysql, but doesn’t matter what I set, always I have the same date in the code -1 day at 18:00:00
SET @@global.time_zone = '+00:00'; SET @@session.time_zone = '+00:00';
Advertisement
Answer
I solved this adding this in the date field:
@Temporal(TemporalType.DATE)