iBatis ResultMap in a List
Hello,
I'm fairly new to iBatis; still trying to learn. My question is how do I return a ResultMap as a List? Here's an example I found on Page 30 of the quot;MyBatis User Guidequot;. So, lets say that the select statement returns more than one record, how can I get the resultMap in a List? Using the following API as shown below:HTML Code:
public Listlt;Usergt; getUser( int id );
lt;select id=quot;selectUsersquot; parameterType=quot;intquot; resultMap=quot;userResultMapquot;gt;
select user_id, user_name, hashed_password
from some_table
where id = #{id}
lt;/selectgt;
lt;resultMap id=quot;userResultMapquot; type=quot;Userquot;gt;
lt;id property=quot;idquot; column=quot;user_idquot; /gt;
lt;result property=quot;usernamequot; column=quot;usernamequot; /gt;
lt;result property=quot;passwordquot; column=quot;passwordquot; /gt;
lt;/resultMapgt;
Thanks in advance for your feedback.
-sasims
Simple: You need to call the method provided by iBatis like quot;queryForListquot; and you need to pass the necessary information as they needed. |