[MyBatis] Mapper XML의 resultType

결과값이 하나일 경우

<select id="selectUsers" parameterType="int" resultType="java.lang.String">
  select username
  from some_table
  where id = #{id}
</select>

결과값이 여러 개일 경우 - HashMap

<select id="selectUsers" parameterType="int" resultType="java.util.HashMap">
  select id, username, hashedPassword
  from some_table
  where id = #{id}
</select>

결과값이 여러 개일 경우 - Plain Object

<select id="selectUsers" parameterType="int" resultType="com.someapp.model.User">
  select id, username, hashedPassword
  from some_table
  where id = #{id}
</select>

TypeAliases

<!-- In Config XML file -->
<typeAlias type="com.someapp.model.User" alias="User"/>

<!-- In SQL Mapping XML file -->
<select id="selectUsers" parameterType="int" resultType="User">
  select id, username, hashedPassword
  from some_table
  where id = #{id}
</select>