Spring nested transactions
<p>In my Spring Boot project I have implemented following service method:</p>
<pre><code>@Transactional
public boolean validateBoard(Board board) {
    boolean result = false;
    if (inProgress(board)) {
        if (!canPlayWithCurrentBoard(board)) {
            update(board, new Date(), Board.AFK);
            throw new InvalidStateException(ErrorMessage.BOARD_TIMEOUT_REACHED);
        }
        if (!canSelectCards(board)) {
            update(board, new Date(), Board.COMPLETED);
            throw new InvalidStateException(ErrorMessage.ALL_BOARD_CARDS_ALREADY_SELECTED);
        }
        result = true;
    }
    return result;
}
</code></pre>
<p>Inside this method I use another service method which is called <code>update</code>:</p>
<pre><code>@Transactional(propagation = Propagation.REQUIRES_NEW)
public Board update(Board board, Date finishedDate, Integer status) {
    board.setStatus(status);
    board.setFinishedDate(finishedDate);

    return boardRepository.save(board);
}
</code></pre>
<p>I need to commit changes to database in <code>update</code> method independently of the owner transaction which is started in <code>validateBoard</code> method. Right now any changes is rolling back in case of any exception.</p>
<p>Even with <code>@Transactional(propagation = Propagation.REQUIRES_NEW)</code> it doesn't work.</p>
<p>How to correctly do this with Spring and allow nested transactions ?</p>