You need to enable statement namespaces. See here for an example:

http://ibatis.apache.org/docs/tools/ibator/afterRunning.html

Jeff Butler


On Thu, Aug 20, 2009 at 3:04 AM, bhaa<b...@yandex.ru> wrote:
>
> Hi,
>
> This is file ibatorConfig.xml:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD
> Apache iBATIS Ibator Configuration 1.0//EN"
>  "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd"; >
> <ibatorConfiguration >
>  <classPathEntry
> location="F:\C\Work\RuNetSoft\GUVD\AccGuvd\lib\ojdbc14.jar" />
>  <ibatorContext id="OracleTables" targetRuntime="Ibatis2Java5">
>    <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
>      connectionURL="jdbc:oracle:thin:@ws-krylov:1521:GUVD"
>      userId="guvd_user" password="sys" />
>    <javaModelGenerator targetPackage="com.rns.guvd.model"
>      targetProject="AccGuvd/src" />
>    <sqlMapGenerator targetPackage="com.rns.guvd.xml"
>      targetProject="AccGuvd/src" />
>    <daoGenerator type="GENERIC-CI" targetPackage="com.rns.guvd.dao"
>      targetProject="AccGuvd\src" />
>    <table tableName="account_guvd">
>      <property name="useActualColumnNames" value="true"/>
>    </table>
>  </ibatorContext>
> </ibatorConfiguration>
>
> Generate iBATIS Artifacts is successful, but the test does not work:
>
> public static void main(String[] args) throws SQLException {
>                Reader reader = null;
>                try {
>                        reader =
> Resources.getResourceAsReader("com/rns/guvd/xml/ACCOUNT_GUVD_SqlMap.xml");
>                } catch (IOException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                }
>                SqlMapClient client = SqlMapClientBuilder.buildSqlMapClient 
> (reader);
>                AccountGuvdDAO dao = new AccountGuvdDAOImpl(client);
>                AccountGuvd accountGuvd = dao.selectByPrimaryKey(new 
> BigDecimal(1));
>                System.out.println("//--> " + accountGuvd.toString());
>        }
>
> Exception in thread "main" com.ibatis.sqlmap.client.SqlMapException: There
> is no statement named ACCOUNT_GUVD.ibatorgenerated_selectByPrimaryKey in
> this SqlMap.
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:231)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:509)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82)
>        at
> com.rns.guvd.dao.AccountGuvdDAOImpl.selectByPrimaryKey(AccountGuvdDAOImpl.java:106)
>        at com.rns.guvd.Test_AG.main(Test_AG.java:31)
>
> This is file generated ACCOUNT_GUVD_SqlMap.xml:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-2.dtd"; >
> <sqlMap namespace="ACCOUNT_GUVD" >
>  <resultMap id="ibatorgenerated_BaseResultMap"
> class="com.rns.guvd.model.AccountGuvd" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    <result column="ID_GUVD" property="ID_GUVD" jdbcType="DECIMAL" />
>    <result column="FIRST_NAME" property="FIRST_NAME" jdbcType="VARCHAR" />
>    <result column="LAST_NAME" property="LAST_NAME" jdbcType="VARCHAR" />
>    <result column="EMAIL" property="EMAIL" jdbcType="VARCHAR" />
>  </resultMap>
>  <sql id="ibatorgenerated_Example_Where_Clause" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    <iterate property="oredCriteria" conjunction="or" prepend="where"
> removeFirstPrepend="iterate" >
>      <isEqual property="oredCriteria[].valid" compareValue="true" >
>        (
>        <iterate prepend="and"
> property="oredCriteria[].criteriaWithoutValue" conjunction="and" >
>          $oredCriteria[].criteriaWithoutValue[]$
>        </iterate>
>        <iterate prepend="and"
> property="oredCriteria[].criteriaWithSingleValue" conjunction="and" >
>          $oredCriteria[].criteriaWithSingleValue[].condition$
>            #oredCriteria[].criteriaWithSingleValue[].value#
>        </iterate>
>        <iterate prepend="and"
> property="oredCriteria[].criteriaWithListValue" conjunction="and" >
>          $oredCriteria[].criteriaWithListValue[].condition$
>          <iterate property="oredCriteria[].criteriaWithListValue[].values"
> open="(" close=")" conjunction="," >
>            #oredCriteria[].criteriaWithListValue[].values[]#
>          </iterate>
>        </iterate>
>        <iterate prepend="and"
> property="oredCriteria[].criteriaWithBetweenValue" conjunction="and" >
>          $oredCriteria[].criteriaWithBetweenValue[].condition$
>          #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
>          #oredCriteria[].criteriaWithBetweenValue[].values[1]#
>        </iterate>
>        )
>      </isEqual>
>    </iterate>
>  </sql>
>  <select id="ibatorgenerated_selectByExample"
> resultMap="ibatorgenerated_BaseResultMap"
> parameterClass="com.rns.guvd.model.AccountGuvdExample" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    select ID_GUVD, FIRST_NAME, LAST_NAME, EMAIL
>    from ACCOUNT_GUVD
>    <isParameterPresent >
>      <include refid="ACCOUNT_GUVD.ibatorgenerated_Example_Where_Clause" />
>      <isNotNull property="orderByClause" >
>        order by $orderByClause$
>      </isNotNull>
>    </isParameterPresent>
>  </select>
>  <select id="ibatorgenerated_selectByPrimaryKey"
> resultMap="ibatorgenerated_BaseResultMap"
> parameterClass="com.rns.guvd.model.AccountGuvd" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    select ID_GUVD, FIRST_NAME, LAST_NAME, EMAIL
>    from ACCOUNT_GUVD
>    where ID_GUVD = #ID_GUVD:DECIMAL#
>  </select>
>  <delete id="ibatorgenerated_deleteByPrimaryKey"
> parameterClass="com.rns.guvd.model.AccountGuvd" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    delete from ACCOUNT_GUVD
>    where ID_GUVD = #ID_GUVD:DECIMAL#
>  </delete>
>  <delete id="ibatorgenerated_deleteByExample"
> parameterClass="com.rns.guvd.model.AccountGuvdExample" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    delete from ACCOUNT_GUVD
>    <include refid="ACCOUNT_GUVD.ibatorgenerated_Example_Where_Clause" />
>  </delete>
>  <insert id="ibatorgenerated_insert"
> parameterClass="com.rns.guvd.model.AccountGuvd" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    insert into ACCOUNT_GUVD (ID_GUVD, FIRST_NAME, LAST_NAME, EMAIL)
>    values (#ID_GUVD:DECIMAL#, #FIRST_NAME:VARCHAR#, #LAST_NAME:VARCHAR#,
> #EMAIL:VARCHAR#)
>  </insert>
>  <insert id="ibatorgenerated_insertSelective"
> parameterClass="com.rns.guvd.model.AccountGuvd" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    insert into ACCOUNT_GUVD
>    <dynamic prepend="(" >
>      <isNotNull prepend="," property="ID_GUVD" >
>        ID_GUVD
>      </isNotNull>
>      <isNotNull prepend="," property="FIRST_NAME" >
>        FIRST_NAME
>      </isNotNull>
>      <isNotNull prepend="," property="LAST_NAME" >
>        LAST_NAME
>      </isNotNull>
>      <isNotNull prepend="," property="EMAIL" >
>        EMAIL
>      </isNotNull>
>      )
>    </dynamic>
>    values
>    <dynamic prepend="(" >
>      <isNotNull prepend="," property="ID_GUVD" >
>        #ID_GUVD:DECIMAL#
>      </isNotNull>
>      <isNotNull prepend="," property="FIRST_NAME" >
>        #FIRST_NAME:VARCHAR#
>      </isNotNull>
>      <isNotNull prepend="," property="LAST_NAME" >
>        #LAST_NAME:VARCHAR#
>      </isNotNull>
>      <isNotNull prepend="," property="EMAIL" >
>        #EMAIL:VARCHAR#
>      </isNotNull>
>      )
>    </dynamic>
>  </insert>
>  <select id="ibatorgenerated_countByExample"
> parameterClass="com.rns.guvd.model.AccountGuvdExample"
> resultClass="java.lang.Integer" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    select count(*) from ACCOUNT_GUVD
>    <include refid="ACCOUNT_GUVD.ibatorgenerated_Example_Where_Clause" />
>  </select>
>  <update id="ibatorgenerated_updateByExampleSelective" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    update ACCOUNT_GUVD
>    <dynamic prepend="set" >
>      <isNotNull prepend="," property="record.ID_GUVD" >
>        ID_GUVD = #record.ID_GUVD:DECIMAL#
>      </isNotNull>
>      <isNotNull prepend="," property="record.FIRST_NAME" >
>        FIRST_NAME = #record.FIRST_NAME:VARCHAR#
>      </isNotNull>
>      <isNotNull prepend="," property="record.LAST_NAME" >
>        LAST_NAME = #record.LAST_NAME:VARCHAR#
>      </isNotNull>
>      <isNotNull prepend="," property="record.EMAIL" >
>        EMAIL = #record.EMAIL:VARCHAR#
>      </isNotNull>
>    </dynamic>
>    <isParameterPresent >
>      <include refid="ACCOUNT_GUVD.ibatorgenerated_Example_Where_Clause" />
>    </isParameterPresent>
>  </update>
>  <update id="ibatorgenerated_updateByExample" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    update ACCOUNT_GUVD
>    set ID_GUVD = #record.ID_GUVD:DECIMAL#,
>      FIRST_NAME = #record.FIRST_NAME:VARCHAR#,
>      LAST_NAME = #record.LAST_NAME:VARCHAR#,
>      EMAIL = #record.EMAIL:VARCHAR#
>    <isParameterPresent >
>      <include refid="ACCOUNT_GUVD.ibatorgenerated_Example_Where_Clause" />
>    </isParameterPresent>
>  </update>
>  <update id="ibatorgenerated_updateByPrimaryKeySelective"
> parameterClass="com.rns.guvd.model.AccountGuvd" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    update ACCOUNT_GUVD
>    <dynamic prepend="set" >
>      <isNotNull prepend="," property="FIRST_NAME" >
>        FIRST_NAME = #FIRST_NAME:VARCHAR#
>      </isNotNull>
>      <isNotNull prepend="," property="LAST_NAME" >
>        LAST_NAME = #LAST_NAME:VARCHAR#
>      </isNotNull>
>      <isNotNull prepend="," property="EMAIL" >
>        EMAIL = #EMAIL:VARCHAR#
>      </isNotNull>
>    </dynamic>
>    where ID_GUVD = #ID_GUVD:DECIMAL#
>  </update>
>  <update id="ibatorgenerated_updateByPrimaryKey"
> parameterClass="com.rns.guvd.model.AccountGuvd" >
>    <!--
>      WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
>      This element was generated on Thu Aug 20 11:30:09 MSD 2009.
>    -->
>    update ACCOUNT_GUVD
>    set FIRST_NAME = #FIRST_NAME:VARCHAR#,
>      LAST_NAME = #LAST_NAME:VARCHAR#,
>      EMAIL = #EMAIL:VARCHAR#
>    where ID_GUVD = #ID_GUVD:DECIMAL#
>  </update>
> </sqlMap>
>
> Explain please why it does not work.
>
> Alexander
>
> --
> View this message in context: 
> http://www.nabble.com/iBATOR%2BiBATIS-generation-is-successful%2C-but-test-does-not-work.-tp25057730p25057730.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: user-java-h...@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to