Looks like the postgres dialect doesn't have a dateadd function. Does postgres? If it does, and if you're willing to recompile your hibernate jar, you could registerFunction whatever the dateadd function postgres provides, then use it in HQL.
Have a look in PostgreSQLDialect.java. Add a registerFunction in where all the others are.
If postgres doesn't have a function that adds to dates, then there's not much you can do. You could use the year(), month() etc. functions, but there's a lot of work figuring out month and year changes, leap years, etc. Might as well just do it in java, it's easy enough with Calendar objects.
_________________ Code tags are your friend. Know them and use them.
|