跪求,JAVA SQL查询某个时间段的代码
if(null!=job&&null!=job.getCreateTime()&&!"".equals(job.getCreateTime())){SimpleDateF...
if(null!= job &&null!=job.getCreateTime()&&!"".equals(job.getCreateTime())) {
SimpleDateFormat currentTime = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
String s=currentTime.format(new Date());
hql.append(" and j.createTime between to_date('"+s+"', 'yy-MM-dd HH24:mi:ss'" + " and :createTime ");
// hql.append(" and j.createTime between" +currentTime+ " and :createTime ");
map.put("createTime","%"+ job.getCreateTime()+"%");
}
expecting CLOSE, found 'null' near line 1, column 175 [select distinct j from recruitment.model.Job j where 1 = 1 and j.numPosition > 0 and j.createTime between to_date('14-04-14 12:25:17', 'yy-MM-dd HH24:mi:ss' and :createTime ]
这里createTime数据库里面是timestamp, Java里面l类型是Date,我用的是HQL, MYSQL 展开
SimpleDateFormat currentTime = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
String s=currentTime.format(new Date());
hql.append(" and j.createTime between to_date('"+s+"', 'yy-MM-dd HH24:mi:ss'" + " and :createTime ");
// hql.append(" and j.createTime between" +currentTime+ " and :createTime ");
map.put("createTime","%"+ job.getCreateTime()+"%");
}
expecting CLOSE, found 'null' near line 1, column 175 [select distinct j from recruitment.model.Job j where 1 = 1 and j.numPosition > 0 and j.createTime between to_date('14-04-14 12:25:17', 'yy-MM-dd HH24:mi:ss' and :createTime ]
这里createTime数据库里面是timestamp, Java里面l类型是Date,我用的是HQL, MYSQL 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询