hibernatesearchhibernate-generic-dao

Hibernate generic DAO search


I'm using the hibernate generic dao project. I need to search for all records where the 'date1' field is earlier than 'date2', something like:

search.addFilterLessThan('date1', 'date2');

However it seems from the API that the search only accepts values as the second argument and not properties:

Date date = ...;
search.addFilterLessThan('date1', date);

Is there a way to filter based on two record fields?


Solution

  • Got an answer from the project's group, it's done using custom filters:

    search.addFilterCustom("{date1} < {date2}");