<typeAlias alias="Product" type="com.shopping.entity.Product"/> <typeAlias alias="ProductType" type="com.shopping.entity.ProductType"/> <resultMap id="queryAllProduct" class="Product"> <result property="proId" column="proid"/> <result property="proName" column="proname"/> <result property="proDesc" column="prodesc"/> <result property="price" column="price"/> <result property="img" column="img"/> <result property="proTime" column="protime"/> <result property="size" column="size"/> <result property="type" column="typeid" select="queryProductTypeById"/> </resultMap> <select id="queryProductTypeById" parameterClass="int" resultClass="ProductType" > select typeid,typename from producttype where typeid=#typeid# <select> <select id="queryAllProducts" resultMap="queryAllProduct"> select proid,proname,prodesc,price,img,protime,size,typeid from product <select>
原文地址:http://blog.csdn.net/u010056403/article/details/38875997