Could not obtain transaction-synchronized Session for current thread 报错在spring注解定时任务上的处理
来源:互联网 发布:情定三生知夏恢复记忆 编辑:程序博客网 时间:2024/05/29 13:56
昨天用spring的注解写了一个定时任务,处理超时订单置为失效的。刚开始这样写的
@Service
public class CheckTimeoutCbosJob {
//
@Autowired
private CbosMainOrderService cbosMainOrderService;
List<CbosMainOrder> list=cbosMainOrderService.findTimeOutOrder(DAY);//这一行就报错,内容就是Could not obtain transaction-synchronized Session for current thread
}
最终在类上面加上@Transactional就好了,如下
@Service
@Transactional
public class CheckTimeoutCbosJob {
0 0
- Could not obtain transaction-synchronized Session for current thread 报错在spring注解定时任务上的处理
- spring整合hibernate报错:Could not obtain transaction-synchronized Session for current thread
- SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
- SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
- SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
- 报错 Could not obtain transaction-synchronized Session for current thread
- Hibernate报错:Could not obtain transaction-synchronized Session for current thread
- SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
- SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
- SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
- SpringMVC4+Hibernate4运行报错Could not obtain transaction-synchronized Session for current thread
- 【Hibernate】Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- HibernateException: Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- Could not obtain transaction-synchronized Session for current thread
- 【译】避免打断链式结构:使用.compose( )操作符、CompositeSubscription
- sql server 存入中文前加N
- 深入PHP面向对象、模式与实践——高级特性(1)
- 银行拆借利率报价
- 多线程中同步异步函数与串行并发队列的组合情况
- Could not obtain transaction-synchronized Session for current thread 报错在spring注解定时任务上的处理
- 数据结构之栈(java版)
- Ubuntu14.04安装mysql-python(MySQL)
- Java中内存分配和回收策略、新生代、老年代
- 题目1007:奥运排序问题
- 记一次JSON到前台乱码的解决方案
- layout_marginRight不起作用
- springMVC--4种映射处理器handlerMapping
- GCC C语言处理主要函数之init_pragma