循环中不要放入openSession()
for(Shop s:list) {
System.out.println(s.getName());
String sql="select shopId,sum(ele_bank+ele_card+water_card+water_bank+coal_card+coal_bank) as zonghe ,sum(sale_bank+sale_card) as sale,sum(cigarette_card+cigarette_bank) as bacco, sum(yidong_card+yidong_bank+dianxin_card+dianxin_bank) as recharge from hs_shop_items where record_time like '%2013-12-12%' and shopId="+s.getId();
Session officeSession=officeSessionFactory.openSession();
officeSession.beginTransaction();
SQLQuery queryOffice=officeSession.createSQLQuery(sql);
List<ShopTransDTO> r=queryOffice.addEntity(ShopTransDTO.class).list();
res.add(r.get(0));
}
如上图中的
|
1
2
|
Session officeSession=officeSessionFactory.openSession(); officeSession.beginTransaction(); |
这个部分放在循环中是错误的
循环中不要放入openSession()的更多相关文章
- winfrom保存图片,将文件夹中图片放入listview,与撤回操作
之前那些操作完成对图片的修改之后,就是要保存图片了. 这里保存用到一个SaveFileDialog控件,可以获取用户选择的保存文件的路径. ) { SaveFileDialog saveImageDi ...
- Android中ListView放入PopupWindow产生问题解决
今天在做项目时候发现将ListView放入PopupWindow产生问题,ListView放入PopupWindow后 对PopupWindow设置了setFocusable(true)这时候其他的控 ...
- Kendo UI中TreeView 放入tabstrip中,大数据量时超过边框的解决方案。
参考http://www.kendoui.com/forums/ui/tabstrip/tabstip-with-treeview-treeview-breaking-out-of-tabstrip. ...
- 将root 当成arraylist放入数据sturts2 入门笔记
刚启动idea 就报出错误 [-- ::,] Artifact -sturts2:war exploded: Error during artifact deployment. See server ...
- JAVA ArrayList实现随机生成数字,并把偶数放入一个列表中
package Code429; import java.util.ArrayList;import java.util.Random; public class CodeArrayListPrint ...
- C语言:将3*4矩阵中找出行最大,列最小的那个元素。-将低于平均值的人数作为函数返回值,将低于平均分的分数放入below数组中。
//将3*4矩阵中找出行最大,列最小的那个元素. #include <stdio.h> #define M 3 #define N 4 void fun(int (*a)[N]) { ,j ...
- tuple放入dict中
tuple放入dict中是否可以正常运行 # 将tuple放入dict中 a = ('AI','Kobe','Yao') b = ('AI',['Kobe','Yao']) dict1 = {'a': ...
- java通过文件路径读取该路径下的所有文件并将其放入list中
java通过文件路径读取该路径下的所有文件并将其放入list中 java中可以通过递归的方式获取指定路径下的所有文件并将其放入List集合中.假设指定路径为path,目标集合为fileList,遍 ...
- 在查询时将查询条件放入Session中,导出时直接根据qpniRGaFiler取查询条件即可
在查询时将查询条件放入Session中,导出时直接根据qpniRGaFiler取查询条件即可
随机推荐
- http 4中 cache 头
// head['Cache-Control']='max-age=31536000'; // head['Expires']=new Date((new Date().getTime()+99999 ...
- tomcat 优化实记
好记性不如烂笔头,以下是 tomcat 无脑优化 1.内存设置(VM参数调优)(1). Windows环境下,是tomcat解压版(执行startup.bat启动tomcat) 解决办法:修改“%T ...
- Oracle 一次执行多条语句
在.Net使用多次方法一次执行多条语句都不成功, 百度了许久才找到正确的解决方案. Oracle执行多条语句的时候 不能有物理换行 写法对比: 如下写法是不成功. begin into t_test ...
- 1> Strut2 Mapping to MVC
CONTROLLER—FILTERDISPATCHER We’ll start with the controller. It seems to make more sense to start th ...
- js注册验证【转】
function getFocus() //设置用户名文本框获取焦点 { document.getElementById("txtuname").focus(); } functi ...
- hdu 1063 Exponentiation
求实数的幂,这个用C++写的话有点长,但是用Java写就非常方便了…… ); System.out.println(an); } }}
- NET权限系统开源项目
http://www.cnblogs.com/yubaolee/p/OpenAuth.html http://www.cnblogs.com/guozili/p/3496265.html Sereni ...
- Cache 应用程序数据缓存
System.Web.Caching 命名空间提供用于缓存服务器上常用数据的类.此命名空间包括 Cache 类,该类是一个字典,您可以在其中存储任意数据对象,如哈希表和数据集.它还为这些对象提供了失效 ...
- hdu1017
http://acm.hdu.edu.cn/showproblem.php?pid=1017 #include<iostream> #include<stdio.h> #inc ...
- Linux Shell 数字计算与比较
直接上脚本, 使用$(())以及$[]进行数字计算 数值比较:n1 -eq n2检查n1是否等于n2 n1 -le n2检查n1是否小于等于n2n1 -ge n2检查n1是否大于等于n ...