一、Java代码
public class CocBean { private String name; private Double volume; //get() / set() }
public class CocTreeNode extends CocBean { private String level1; private String level2; //get() and set() }
二、XML Mapper
<resultMap id="CocBeanResult" type="CocBean"> <result property="name" column="NAME"/> <result property="volume" column="VOLUME"/> </resultMap> <resultMap id="simpleRow" type="CocTreeNode" extends="CocBeanResult"> <result property="level1" column="LEVEL1"/> <result property="level2" column="LEVEL2"/> </resultMap>
已验证,正确