How to assign Date parameters to Hibernate query for current timezone?

后端 未结 5 531
眼角桃花
眼角桃花 2021-01-31 02:57

When you assign a date to a named SQL parameter Hibernate automatically converts it to GMT time. How do you make it use the current server timezone for all dates?

Lets s

5条回答
  •  孤独总比滥情好
    2021-01-31 03:20

    If you need a timeZone synchronized value you can use now() in your HQL. Also I suggest you to use the Joda library. It has a hibernate-plugin module.

提交回复
热议问题