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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -