spring rollback when error
I am using AOP to manage my transactions with @Transactional on my services. And that works very well when a runtime exception occurs a rollback is performed. (I use hibernate and spring manage my hibernate layer)
But sometimes a java.lang.outOfMemoryError occurs during the transaction (caused by my own bad management of memory), then Spring can't call rollback and data stay persisted.
do you know a solution to prevent this ?
I supposed that the transaction use "BEGIN TRANSACTION... sql code...COMMIT" for the transaction of my method, but i don't how it is possible to maintains transaction if I have nested transaction. I am investigating on that.
Thank you for your help.