Hibernate Criteria for Dates
问题 In oracle I have dates in format 17-April-2011 19:20:23.707000000 I would like to retrieve all orders for 17-04-2011. SimpleDateFormat formatter = new SimpleDateFormat(\"dd-MM-YYYY\"); String myDate = \"17-04-2011\"; Date date = formatter.parse(myDate); Criteria criteria = session.createCriteria(Order.class); Criterion restrictDate = Restrictions.like(\"orderDate\",date); but it brings me empty result: 回答1: Why do you use Restrictions.like(... )? You should use Restrictions.eq(...) . Note you