春季交易管理员;什么意思是NewTransaction()?
我正在将传统应用程序转换为Spring-boot。对于API实施,我想用@transactional注释它,但需要实现自定义的TransactionManager。
当我定义时:
@Component
public class MyTransactionManager implements PlatformTransactionManager { ... }
接口platformTransActionManager
需要实现三种方法...
commit()
and and rollback()
很明显。
但是getTransaction()
应返回类型trassactionstatus
使用方法boolean isNewTransaction()
此返回值的目的到底是什么? 何时应该返回true
vs false
?
如果我没有嵌套交易,可以始终返回true吗? (或总是错误的?)
I am converting a legacy application to spring-boot. For the API-implementation I want to annotate it with @Transactional, but need to implement a custom transactionManager.
When I define:
@Component
public class MyTransactionManager implements PlatformTransactionManager { ... }
the interface PlatformTransactionManager
requires three methods be implemented...
commit()
and rollback()
are obvious.
But getTransaction()
should return a type TransactionStatus
with a method boolean isNewTransaction()
What exactly is the purpose of this return value?
When should it return true
vs false
?
If I have no nested transaction, is it OK to always return true? (or always false?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论