日期:2014-05-16  浏览次数:20887 次

Hibernate access HQL 日期时间 Date 与oracle时的区别

由oracle转access后,发现查询某段时间时报错,折腾了一下午了,终于出来了,共享一下:

public ArrayList queryVO_DBSByDate(String findDate00, String findDate24) throws ParseException {
//        return (ArrayList) super
//                .queryList("from VO_DBS v where v.cDate between to_date('"
//                        + findDate00
//                        + "','YYYY-MM-DD HH24:MI:SS') and to_date('"
//                        + findDate24 + "','YYYY-MM-DD HH24:MI:SS')");
   
        return (ArrayList) super
        .queryList("from VO_DBS v where v.cDate > '"+ findDate00+ "'and v.cDate<'" + findDate24
                + "'");
        
    }

?

以上,注释掉的是使用于oracle的日期段查询,其下面的是适用于ACCESS的。