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

来源:互联网 发布:ubuntu qemu xen 编辑:程序博客网 时间:2024/05/16 10:40

由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的。