MongoDB and MySql Transaction

霸气de小男生 提交于 2021-02-11 18:04:51

问题


I need to execute a multiple MySql Queries and Multiple MongoDB queries. If the execution of one of the queries fails (SQL or Mongo) I must rollback all the executed queries. Is that possible?


回答1:


You might want to check out Spring Transactions. This is one of the solutions I am aware of. Another solution might be to do it manually: store the current documents/rows try to update them and roll back if necessary.

It might help to take a step back and ask yourself whether it really makes sense to have two DBMS with dependent transactions. I'd do everything to be able to store the related data in one DBMS.



来源:https://stackoverflow.com/questions/24290477/mongodb-and-mysql-transaction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!