I have a mapped class that has a date property. I would like to saveOrUpdate objects of this class so that already existing is updated only if it is older than the stored one.
How would I do that (neatly and efficiently if possible)?
I have a lot of classes like this so I would hope to avoid writing tons of custom HQL for all of them.
try having a look at HibernateTemplate.saveOrUpdate from Spring . it has the same functionality as required.bieng open source you may see the code as well for implementation