title: How to get List<String> inside of a POJO with MyBatis Mapper?
body: <p>My goal is to fill the <code>UserDto</code> POJO using the 'UsersMapper' MyBatis Mapper.</p>
  <pre><code>public class UserDto {
    private String username;
    private String password;
    private List&lt;String&gt; authorities;
  
    public String getUsername() {
      return username;
    }
  
    public String getPassword() {
      return password;
    }
  
    public Set&lt;SimpleGrantedAuthority&gt; getAuthorities() {
      return authorities.stream()
              .map(SimpleGrantedAuthority::new)
              .collect(Collectors.toSet());
    }
  }
  </code></pre>
  <pre><code>@Mapper
  public interface UsersMapper {
    @Select(&quot;SELECT users.username, users.password, role_authorities.authority &quot; +
            &quot;FROM users &quot; +
            &quot;JOIN role_members ON role_members.username = users.username &quot; +
            &quot;AND users.username=#{username} &quot; +
            &quot;JOIN role_authorities ON role_authorities.role_uuid = role_members.role_uuid&quot;)
    Optional&lt;UserDto&gt; getUsers(String username);
  }
  </code></pre>
  <p>This is how it looks like if I run the SQL statement directly.
  <a href="https://i.stack.imgur.com/1lo6Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1lo6Q.png" alt="enter image description here" /></a></p>
  <p>My expected result is: MyBatis successfully fill the <code>UserDto</code> POJO.</p>
  <p>My actual result is I got an exception</p>
  <pre><code>org.springframework.security.authentication.InternalAuthenticationServiceException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 3
  </code></pre>