1.在同一个事务中只开启一个sqlSession。
2.在mapper中collection嵌套select只开了一个SqlSession
<resultMap id="UserOrderIdMap" type="com.zk.domain.User">
<id property="id" column="id"></id>
<result property="userName" column="username"></result>
<collection property="orderIdList"
column="{userId=id}"
select="selectOrderIdByUserId"/>
</resultMap>
<select id="selectUserOrderId" resultMap="UserOrderIdMap">
select u.id,u.username from t_user u
</select>
<select id="selectOrderIdByUserId" resultType="java.lang.Integer">
select * from t_order where uid=#{userId}
</select>