title: Commit exception stack-trace to database when transaction fails
body: <p>I have my transactional public method which tries to delete many stuff from database.
  Also there is database table, containing information about errors during this deletion process.
  However, I need it to work in a way that when there is exception thrown during the deletion process, all deletions will be rolled back and a commit new entry to database with the exception stack trace.
  My code looks something like this:</p>
  <pre><code>class Clazz{
       
       @Transactional
       public void classMethod(){
            try {
                 deleteStuff();
            } catch (Exception e) {
                 logRepository.save(new ErrorLog(e.getMessage()));
            }
       }
  }
  </code></pre>
  <p>As far as I'm concerned, this code would not work, because the exception is caught in the try-catch block, so the log will be saved to database, but the deletions would not be rolled back.
  I've read about <code>TransactionSynchronizationAdapter#afterCompletion</code> method, but there is no way to access the stack trace of the exception thrown from that method.</p>
  <p>So my question is, is there any way to catch the exception, save stack trace to database and rollback all the other commits?
  Thanks in advance.</p>