首页 新闻 赞助 找找看

ibatis statements extends ibatis关于调用另外一个xml中的方法

0
悬赏园豆:20 [已关闭问题] 关闭于 2011-12-06 09:32

我写了两个ibatis的xml一个

product_base.xml

product_base.xml

product.xml

而且他们的命名空间一样。

我现在product.xml用 extends="GetAllProduct2"扩展其中的一个方法

但是报错

Unable to find extend statement named 'GetAllProduct2' on statement 'GetAllProduct'.'

product_base.xml

<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Product" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- 别名-->
  <alias>
    <typeAlias alias="Product" type="Domain.Product,Domain" />
  </alias>
  <!-- 返回类型-->
  <resultMaps>
    <resultMap id="ProductResult" class="Product">
      <result property="ProductId" column="ProductId" />
      <result property="ProductName" column="ProductName" />
    </resultMap>
  </resultMaps>

  <statements xsi:noNamespaceSchemaLocation="" >
<!--查询语句-->
    <select id="GetAllProduct2"  resultMap="ProductResult">
      select *  from t_Product
    </select>

    <select id="GetAllProductByName" parameterClass="string"  resultMap="ProductResult">
      select *  from t_Product where ProductId=#value#
    </select>

    <select id="GetAllProductByModel" parameterClass="Product"  resultMap="ProductResult">
      select *  from t_Product where ProductId=#ProductId#
    </select>

  </statements>
</sqlMap>

product.xml

<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Product" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- 别名-->
  <!--<alias>
    <typeAlias alias="Product" type="Domain.Product,Domain" />
  </alias>-->
  <!-- 返回类型-->
  <resultMaps>
    <resultMap id="ProductResult2" class="Product"   extends="ProductResult">
   
      <result property="ProductCode" column="ProductCode" />
    </resultMap>
  </resultMaps>

  <statements >
    <!-- 查询语句-->

   <!--<select id="GetAllProduct2"  resultMap="ProductResult2">
      select *  from t_Product
    </select>-->
    <select id="GetAllProduct"  resultMap="ProductResult2" extends="GetAllProduct2">
    </select>
  </statements>
</sqlMap>

awp110的主页 awp110 | 初学一级 | 园豆:12
提问于:2011-08-15 10:35
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册