Suppose I have a class TransactionDetails. This table holds transaction of last 10 year. Now How can i get all TransactionDetails of current year
I am using criteria as following
Criteria criteria = session.getCurrentSession().createCriteria(TransactionDetails.class);
criteria.add(Restrictions.eq("entryDate", thisYear));
return (List<TransactionDetails>) criteria.list();
I know I can achieve this by detecting beginning of year and end of year and the do a query with between operator. But I am looking for a way do this in one line. e.g. like in sql we use CURDATE()
How can this be done??
from Newest questions tagged java - Stack Overflow http://ift.tt/1MuQbVb
via IFTTT
Aucun commentaire:
Enregistrer un commentaire