I try to add a number of days to a specific Date in my Table using Hibernate.
My App should work on MSSQL and PostgreSQL, so I try to find a global way for working with Dates because I don't want to implement different methods for each Database.
Using MSSQL should work like this
Code:
Iterator iterate = getHibernateTemplate().iterate("from Rechnung r where (r.mandant.id >= ?) and (r.mandant.id <= ?) and (DATEADD(day, 30, r.rechnungsDatum) <= ?)", ...)
PostgreSQL looks like this
Code:
terator iterate = getHibernateTemplate().iterate("from Rechnung r where (r.mandant.id >= ?) and (r.mandant.id <= ?) and ((r.rechnungsDatum + 30 as days) <= ?)", ...)
Please help.
THX