【发布时间】:2018-07-24 08:17:45
【问题描述】:
此代码用于显示当月销售的天数
public long getCountsOfQuery(String condition, Class outputclass) throws Exception {
Session session = BuilderSession.getSession();
return Long.parseLong(session.createSQLQuery(condition).uniqueResult().toString());
}
我的 JSP 文件是:
<td><%= ho.getCountsOfQuery("select COUNT(*) from store_sales where date like '"+ fd.getPartDate(FormatDate.PART_YEAR)+fd.getPartDate(FormatDate.PART_MONTH)+"01"+"' ", object.getClass()) %></td>
<td><%= ho.getCountsOfQuery("select COUNT(*) from store_sales where date like '"+ fd.getPartDate(FormatDate.PART_YEAR)+fd.getPartDate(FormatDate.PART_MONTH)+"02"+"' ", object.getClass()) %></td>
....
<td><%= ho.getCountsOfQuery("select COUNT(*) from store_sales where date like '"+ fd.getPartDate(FormatDate.PART_YEAR)+fd.getPartDate(FormatDate.PART_MONTH)+"31"+"' ", object.getClass()) %></td>
两次运行后无法响应休眠中的查询。
此外,运行时不会发生错误。
请帮帮我。
【问题讨论】:
-
“在休眠状态下运行两次后无法响应查询”是什么意思?
-
请不要使用脚本
标签: java mysql sql database hibernate