I've been using Spring framework and MySQL database in my project and I have problems to manage change both into database and files system. Until now I managed, for each transaction, only one operation for database and file so I developed them manually with try- catch but now I have some method with several operations. For example I should:
- Rename a lot of files in different folders and rename even archive files (unzip-rename-zip)
- Change some database fields
If one of the above activities fails then I have to rollback all the operations, so give to the files the original name and restore database values.
I read about Apache commons-transactions
but there isn't a useful documentation, is it a good choise for my requirements?
Reading this article I thought to create a FileResourceManager
singleton and call start and id from the other classes. But does it manage my unzip-rename-zip procedure?
Otherwise I have to create a backup of folders and replace all in case of error. Thanks