title: Spring @Transactional rollbacks when InvalidCredentialsException is thrown
body: <p>I have the following code that saves failed login count to the database when user is not validated and then throws <code>InvalidCredentialsException</code>. However, <code>rollbackFor</code> causing rollback after saving the data to the database. I think there is a relation between <code>InvalidCredentialsException</code> and <code>JOSEException.class</code>, <code>JsonProcessingException.class</code> that are in the <code>rollbackFor</code> field. But I cannot see the relation and have no idea how to exclude the exception (<code>InvalidCredentialsException</code>) from rollback.</p>
  <pre><code>@Override
  @LogExecution
  @Transactional(rollbackFor = {JOSEException.class, JsonProcessingException.class})
  public UserTokenDTO login(final LoginRequest request)
          throws JsonProcessingException, JOSEException {
  
      // code omitted
  
      if (user.isNotValidated) {
          setFailedLoginCount();
          throw new InvalidCredentialsException();
      }
  }
  
  </code></pre>
  <p>So, should I change <code>rollbackFor</code> values?</p>