控制台输出的信息如下
Fri May 04 00:00:00 CST 2007
from Account a where a.manextPayTime=Fri May 04 00:00:00 CST 2007然后就执行不了this.getSession().createQuery(hql1).list();了
哪位高手帮帮忙啊。

解决方案 »

  1.   

    String hql="from Account a where a.manextPayTime=?";
    session.createQuery(hql).setDate(1,date).list();
      

  2.   

    即使你想比较字符串也要加单号,如果输出是
    from Account a where a.manextPayTime='Fri May 04 00:00:00 CST 2007'
    也会好理解一些,当然这样是不行的.
      

  3.   

    还是不行,还是执行不了session.createQuery(hql).setDate(1,date).list();我想请问我把String类型的参数转换成Date类这样写对不对
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       String str = year+"-"+month+"-"+day+" "+"00:00:0";
       Date date =sdf.parse(str);
       System.out.println(date);