查询结果有多条:
select * from testone
测试程序写为 List one = session.selectList() for循环取值.
联合查询:
一个java类需要关联另一个java类,即存在 private Teacher teacher;属性
对应的mapper.xml中:
<resultMap type="com.communityhealth.model.Student" id="class">
<id property="Sname" column="Sname"/>
<result property="s" column="S#"/>
<result property="sex" column="Ssex"/>
<collection property="teacher" ofType="com.communityhealth.model.Teacher"> <!--property中的值和属性值对应,若要设为list,对应pravite List<Teacher> teachers;property="teachers"-->
<id property="name" column="Tname"/>
</collection>
</resultMap>