81,092
社区成员
发帖
与我相关
我的任务
分享
select ds from com.ydyd.gf.domain.DxSendHistory ds WHERE 1=0 OR ds.recvtime BETWEEN Mon Dec 12 22:36:40 CST 2016 AND Tue Dec 13 22:36:40 CST 2016
nested exception is org.hibernate.hql.ast.QuerySyntaxException:
logger.info("开始dao中的loadByDate()方法");
List<DxSendHistory> list = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String begdate = sdf.format(begin);
String currentdate = sdf.format(current);
StringBuffer sql = new StringBuffer();
sql.append(" select ds from DxSendHistory ds WHERE 1=1");
if(begin == null || current == null){
throw new RuntimeException("时间段选择错误!");
}
sql.append(" AND (ds.recvtime >= to_date('"+ begdate +
"','yyyy-MM-dd') AND ds.recvtime < to_date('" +
currentdate + "','yyyy-MM-dd'))" );
if(sendHistory == null ||
sendHistory.getSystemid() == null ||
"".equals(sendHistory.getSystemid())){
throw new RuntimeException("分中心systemid不能为空");
}
sql.append(" AND ds.systemid = '" + sendHistory.getSystemid() + "'"); //这里字符串必须加单引号吗 我之前没加单引号也能执行,不知道会有什么影响?
list = (List<DxSendHistory>)super.createQuery(sql.toString()).list();
logger.info("查询到的更新数据list=" + list);
Query query = session.createQuery("select u from User u where u.birthday between ? and ?");
query.setDate(0,new Date("Mon Dec 12 22:36:40 CST 1990"));
query.setDate(1,new Date("Tue Dec 13 22:36:40 CST 2016"));