java - How to use mybatis get result type as a list after select from database -
in project use mybatis dao , want result arraylist of select row database example
i have employee class , dao interface employee.java
public class employee { private int id; private string name; private string sex; private string phonenumber; }
empinterface.java
public interface empinterface { public arraylist<employeer> selectall(); }
how should write select tag in mapper.xml
of mybatis?
something this:
<resultmap id="baseresultmap" type="package.employee"> <id column="id" jdbctype="numeric" property="id" /> <result column="name" jdbctype="varchar" property="name" /> <result column="sex" jdbctype="varchar" property="sex" /> <result column="phone_number" jdbctype="varchar" property="phonenumber" /> </resultmap> <select id="selectall" resultmap="baseresultmap"> select emp.id, emp.name, emp.sex, emp.phone_number employees emp </select>
Comments
Post a Comment