一、代码
映射domain为继承关系
public class CocTreeNode extends CocBean implements TreeNode{ private String level1, level2; public void setLevel1(String level1){...} public void setLevel2(String level2){...} public String getLevel1(){...} public String getLevel1(){...} } public class CocBean { protected String name; protected Double volume; public void setName(String name){...} public void setVolume(Double volume){...} public String getName(){...} public Double getVolume(){...} }
二、映射xml文件
利用resultMap的extends属性。