我还有一个问题。能否也帮我解决掉。也是hibernate的问题,日期比较的。我想比较数据库某个表里数据类型的DateTime的数据(映射过来是Date类型),函数有三个参数,分别是年,月,日,是String。我想用年月日来跟manexPayTime比较,找到所有比年月日小的记录,下面是我代码public List getAccount(String year,String month,String day) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String str = year+"-"+month+"-"+day+" "+"00:00:0"; Date date =sdf.parse(str); String hql="from Account a where a.manextPayTime<"+date; List customers=this.getSession().createQuery(hql1).list(); return customers; }发现比较不了,不知哪里错了?
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String str = year+"-"+month+"-"+day+" "+"00:00:0";
Date date =sdf.parse(str); String hql="from Account a where a.manextPayTime<"+date;
List customers=this.getSession().createQuery(hql1).list();
return customers;
}发现比较不了,不知哪里错了?