Hibernate Criteria for Dates

前端 未结 4 470
南方客
南方客 2020-11-30 04:54

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 form         


        
4条回答
  •  醉梦人生
    2020-11-30 05:38

    By using this way you can get the list of selected records.

    GregorianCalendar gregorianCalendar = new GregorianCalendar();
    Criteria cri = session.createCriteria(ProjectActivities.class);
    cri.add(Restrictions.ge("EffectiveFrom", gregorianCalendar.getTime()));
    List list = cri.list();
    

    All the Records will be generated into list which are greater than or equal to '08-Oct-2012' or else pass the date of user acceptance date at 2nd parameter of Restrictions (gregorianCalendar.getTime()) of criteria to get the records.

提交回复
热议问题