Package org.apache.ibatis.annotations
Annotation Interface ResultMap
The annotation that specify result map names to use.
How to use:
Mapper interface:
public interface UserMapper { @Select("SELECT id, name FROM users WHERE id = #{id}") @ResultMap("userMap") User selectById(int id); @Select("SELECT u.id, u.name FROM users u INNER JOIN users_email ue ON u.id = ue.id WHERE ue.email = #{email}") @ResultMap("userMap") User selectByEmail(String email); }Mapper XML:
<mapper namespace="com.example.mapper.UserMapper">
<resultMap id="userMap" type="com.example.model.User">
<id property="id" column="id" />
<result property="name" column="name" />
<association property="email" select="selectUserEmailById" column="id" fetchType="lazy"/>
</resultMap>
</mapper>
- Author:
- Jeff Butler
-
Required Element Summary
-
Element Details
-
value
String[] valueReturns result map names to use.- Returns:
- result map names
-