fixedThreadPool.execute(new Runnable() {
public void run() {
Trans.exec(new Atom() {
public void run() {
String tableName = "POS_T_SAVEFLOW s "
+ "LEFT JOIN POS_T_VIP_INFO i ON s.CARD_ID=i.CARD_ID ";
Cnd cnd = Cnd.where(null).andNot("s.flow_id", "in",
"(select flow_id from SMS_PAY)");
String fields = "s.FLOW_ID,s.reduce_amt,i.VIP_NAME,i.VIP_TEL,s.oper_date";
DaoImpl dao = InitService.getDao();
List<Record> list = dao.query(tableName, cnd, fields);
dao.insert(
"SMS_PAY",
Chain.make("FLOW_ID",
record.getString("FLOW_ID")));
}
}
});
我是在线程池开启新线程并执行事务,异常信息如下:
Exception in thread "pool-24-thread-3" Exception in thread "pool-24-thread-1" at org.nutz.trans.Trans.exec(Trans.java:123)
at com.jinyatu.init.MsmSendOnMinutes$2.run(MsmSendOnMinutes.java:125)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
MsmSendOnMinutes.java:125对应的就是Trans.execute(new Atom(){这里