- xml映射
-
<resultMap id="BaseResultMapM" //自定义的ID type="返回结果的VO"> <id column="OID" jdbcType="DECIMAL" property="id" /> <result column="字段名" jdbcType="DECIMAL" property="类属性名" /> //1对1 <association property="类属性名" javaType="类名"> <id column="IID" jdbcType="DECIMAL" property="id" /> <result column="查询字段名" jdbcType="VARCHAR" property="类属性名" /> </association> //-对多配置 collection标签 //ofType 类名 property 类属性名 <collection property="orderItemsList" ofType="类名"> <id column="SID" jdbcType="DECIMAL" property="id" /> <result column="查询字段名" jdbcType="VARCHAR" property="类属性名" /> </collection> </resultMap> <select id="getData" resultMap="BaseResultMapM"> dosomething </select>
注意顺序constructor?,id*,result*,association*,collection*,discriminator
-
顺序错误会引发一场The content of element type "resultMap" must match "(constructor?,id*,result*,association*,collection*,discriminator?)"。。。。。。。。。。
-
转载于:https://my.oschina.net/xpx/blog/1925005