在View和@Transactional中打开会话 [英] Open Session in View vs @Transactional
本文介绍了在View和@Transactional中打开会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在服务层中使用 @Transactional
批注.但是要解决由于视图中的延迟加载而导致的错误,我不得不在视图过滤器中使用 Open Session
.此后,无需使用@Transaction本身即可打开Session并开始事务.那么这是否意味着不需要@Transactions?然后如何在服务层中处理事务和回滚?
I had been using @Transactional
annotations in my Service Layer. But to resolve an error due to Lazy Loading in View I had to use Open Session in View Filter
. After this, without use of @Transaction itself a Session gets opened and transaction starts. So does that mean @Transactions are not required? How will transactions and roll-backs be handled, then in Service Layers?
推荐答案
查看全文