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

后端 未结 5 533
眼角桃花
眼角桃花 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:33

    Hibernate is ignorant of timezones. Any timezone conversion should be done prior to executing the query.

    E.g., if your database server is set to CST, but the user is on EST, you'll need to add 1 hour to any timestamps which are the input to a query.

提交回复
热议问题