问题
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