Mybatis에 여러개의 파라미터를 넘겨줘서 객체나 파라미터를 변환하는 작업을 하지 않고 간단하게 map으로 작업할 수 있다. 


http://code.google.com/p/mybatis/wiki/HowToSelectMultipleParams


즉, 2개의 파라미터를 Mybatis로 넘길려면, 객체를 만들거나 하는 작업없이 

 User selectUser(@Param("username") String usrename, @Param("hashedPassword") String hashedPassword);


paramterType을 map으로 설정할 수 있다. 


<select id=”selectUser” parameterType=”map” resultType=”User”>
  select id, username, hashedPassword
  from some_table
  where username = #{username}
  and hashedPassword = #{hashedPassword}
</sql>

Posted by '김용환'
,