背景
一个任务, 需要开启多个线程,同时跑,
我开启的线程中, 用SpringContextUtil.getBean("")获取了一个service类,
这个service中, 有许多的service和dao 用来处理任务
在这个处理方法中, Transaction trans = this.creditchanneldao.getCSession().getTransaction();
通过提取出事务控制,来进行每个线程的独立事务控制
但是,抛异常
No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
SpringContextUtil.getBean获取的类,没有hibernate的session
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-