association ,collection

mybatis 出现这个错误
Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 24; columnNumber: 17; 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminator?)"
原因是 association ,collection 的出现必须按照(constructor?,id*,result*,association*,collection*,discriminator?)的先后顺序

<resultMap id="BaseResultMap" type="com.aixuexi.train.entity.Course">
<id column="ID" property="id" jdbcType="INTEGER"/>
<result column="SERIES_ID" property="seriesId" jdbcType="INTEGER"/>
<result column="NAME" property="name" jdbcType="VARCHAR"/>
<result column="STATUS" property="status" jdbcType="VARCHAR"/>
<result column="COURSE_TYPE" property="courseType" jdbcType="VARCHAR"/>
<result column="IMG_URL" property="imgUrl" jdbcType="VARCHAR"/>
<result column="START_TIME" property="startTime" jdbcType="TIMESTAMP"/>
<result column="END_TIME" property="endTime" jdbcType="TIMESTAMP"/>
<result column="CONDITIONS" property="conditions" jdbcType="VARCHAR"/>
<result column="SUIT" property="suit" jdbcType="VARCHAR"/>
<result column="INTRODUCE" property="introduce" jdbcType="LONGVARCHAR"/>
<association property="messageObject"
column="ID"
select="com.aixuexi.train.mapper.MessageObjectMapper.selectByPrimaryKey"/>
<collection property="lectruers"
ofType="com.aixuexi.train.entity.Lectruer"
column="id"
javaType="java.util.ArrayList"
select="com.aixuexi.train.mapper.CourseLectruerMapper.selectByCourseId"/>
</resultMap>
原文地址:https://www.cnblogs.com/qianyukun/p/5418170.html