The problem: I want to get all students who born in May.
This is my sql:
Code:
Select * from student where Month(birthday) = 5 (i used mysql)
And session.createQuery:
Code:
String sql = "From student where birthday like :month";
Query query = session.createQuery(sql);
query.setString("month", "%-05-%");
query.list();
But how can i implement by using session.createCriteria?
when i add this statement: criteria.add(Restrictions.like("birthday", "%-05-%")); an error appear because birthday have data type is TimeStamp.