<collection property="mole" select="selectAllMoleByUserId" column="id"></collection>
应该带来所有90行但它只带来10行。我检查了数据库上的查询它工作正常。我正在使用mybatis-spring版本1.1.0。
<resultMap id="base_map" type="com.application.User">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="mint_id" property="mintId" jdbcType="INTEGER" />
<result column="first_name" property="firstName" jdbcType="VARCHAR" />
<result column="last_name" property="lastName" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="user_map" type="com.application.User" extends="base_map">
<result column="first_login" property="firstLogin" jdbcType="BIT" />
<result column="failed_login_count" property="failedLoginCount" jdbcType="INTEGER" />
<result column="clear_id" property="clearId" jdbcType="INTEGER" />
<collection property="mole" select="selectAllMoleByUserId" column="id"></collection>
</resultMap>
<resultMap id="mole_result_map" type="com.application.Mole">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="firstname" property="firstname" jdbcType="VARCHAR" />
<result column="lastname" property="lastname" jdbcType="VARCHAR" />
</resultMap>
<select id="selectAllMoleByUserId" parameterType="java.lang.Integer" resultMap="mole.mole_result_map">
select m.id, m.firstname, m.lastname, m.description
from mole m
where m.user_id=#{userId} and
m.access_granted = true
and m.entity_deleted = false
</select>