单个实体关联查询:
<resultMap id="transactionResultMapEmpower" type="com.xxxx.dal.dataobject.transaction.TransactionDO2" >
<id property="id" column="id"/>
<result property="traderUnitsName" column="trader_units_name"/>
<result property="transactionAmount" column="transaction_amount"/>
<result property="transactionDate" column="transaction_date"/>
<result property="transactionStatus" column="transaction_status"/>
<result property="transactionApplicationTime" column="transaction_application_time"/>
<result property="transactionApplicationUnitName" column="transaction_application_unit_name"/>
<result property="valueEvaluationType" column="value_evaluation_type"/>
<result column="result_id" jdbcType="INTEGER" property="resultId" />
<association property="resultinfoDO"
javaType="com.xxxx.dal.dataobject.resultinfo.ResultinfoDO"
column="result_id"
select="com.ixxxx.dal.mysql.resultinfo.ResultinfoMapper.selectById"
fetchType="eager" >
</association>
</resultMap>
设置mybatis二级缓存策略:
添加一个属性fetchType="eager"
(急加载)
集合查询:
<collection property="roles" ofType="Role"
select="com.jd.wms.mapper.RoleMapper.selectRolesByEmployeeId" column="id">
</collection>