事务回滚时对象状态恢复
我想在事务回滚时恢复所有非事务对象。例如:: 如果一个 List 对象在事务开始之前保存了两个对象,并假设在事务之后又添加了两个对象。在事务回滚时,定义的 List 对象应该恢复其状态,即;应该只包含前两个对象。我正在使用 Spring 声明式事务管理。
感谢您的任何建议,提前...
I would like to restore all non transactional objects on transaction roll back. Ex:: if a List object holds two objects before transaction starts and assume after transaction two more objects are added to it.On transaction rollback the List object defined should restore its state ie; should contain only first two objects.I am using Spring Declarative Transaction management.
Thanks for any suggestions, in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
软件事务内存(STM)可能是解决您问题的一个很好的解决方案。它主要用于处理并发场景,但对于需要回滚功能的单线程应用程序也同样适用。
您可能无法使用 Spring Declarative Transaction 管理,但 STM 模型很容易使用。
Akka-STM (http://doc.akka.io/stm-java) 是一个不错的选择,特别是如果您需要 JTA 支持。还有 Multiverse (http://multiverse.codehaus.org/overview.html) 和其他 Java 实现。
Software Transactional Memory (STM) may be a good solution for your problem. It is primarily meant for handling concurrent scenarios but would work just as well for single threaded applications that need rollback capability.
You are probably not going to be able to use Spring Declarative Transaction management but the STM model is easy to use.
Akka-STM (http://doc.akka.io/stm-java) is a good choice especially if you need JTA support. There is also Multiverse (http://multiverse.codehaus.org/overview.html) and other Java implementations.