Guilherme_82 wrote:
Hi everyone,
which static methods in Restrictions class can I use to query dates with criteria?
The methods ge, gt, lt, le and between did not work.
Can anybody give me a hint?
thanks, Guilherme
If your DB columns are typed correctly and you're using java.util.Date, that should work. See here:
http://www.jroller.com/page/wakaleo/?an ... iteria_api
They use Dates to demonstrate using the Criteria API:
Code:
Criteria criteria = session.createCriteria(Sale.class);
if (startDate != null) {
criteria.add(Expression.ge("date",startDate);
}
if (endDate != null) {
criteria.add(Expression.le("date",endDate);
}
List results = criteria.list();