How to perform date operations in hibernate

前端 未结 8 1093
既然无缘
既然无缘 2020-12-10 03:00

I want to perform data time operations using hibernate HQL.

I want to add and subtract two dates as well as I want to subtract 1 year or 1 month from a particular da

8条回答
  •  孤街浪徒
    2020-12-10 03:26

    See Performing Date/Time Math In HQL? for an example.

    To use custom sql you must wrote an own hibernate dialect and register:

    registerFunction("weekday", 
      new SQLFunctionTemplate(Hibernate.INTEGER, "to_char(?1,'D')") );
    

提交回复
热议问题