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 date.
How is this possible using HQL in hibernate?
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')") );