You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Mario Chavez <ma...@gmail.com> on 2007/02/09 05:07:47 UTC

Ibatis from SVN tag problems

Hello;

I'm trying to get a map working but it fails when I use <generate> tag for
update statement, the error that I get is:

- The error occurred while loading SqlMap.
- loading update tag
- The error occurred in <sqlMap embedded="Maps.Codigos.xml, TestProject"
xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the UpdateClient. ---> System.ArgumentOutOfRangeException: Specified
argument was out of the range of valid values.
Parameter name: index

My parameter maps is like:
  <parameterMaps>
    <parameterMap id="InsertClient" class="Client">
      <parameter property="Code" column="code"/>
      <parameter property="Name" column="name"/>
      <parameter property="RFC" column="RFC"/>
      <parameter property="DataexchangeID" column="dataexchangeid"/>
      <parameter property="Enable" column="enable"/>
      <parameter property="CreatedBy" column="createdby"/>
      <parameter property="CreatedOn" column="createdon"/>
      <parameter property="UpdatedBy" column="updatedby"/>
      <parameter property="UpdatedOn" column="updatedon"/>
    </parameterMap>

    <parameterMap id="UpdateClient" class="Client" extends="InsertClient">
      <parameter property="ID" column="id"/>
  </parameterMap>
  </parameterMaps>

And the statements definition is:
<statements>
    <update id="UpdateClient" parameterMap="UpdateClient"
parameterClass="Client">
      <generate table="Client" by="ID"/>
    </update>
  </statements>

According to documentation 1.6.0 - 3.3.3.4., it should work but it fails. On
section 3.3.4.3. says that if I do not specify parameterMap it can use
parameterClass, but if my definition does not have parameterMap it fails
with:

  ----> IBatisNet.Common.Exceptions.ConfigurationException :
- The error occurred while loading SqlMap.
- loading update tag
- The error occurred in <sqlMap embedded="Maps.Codigos.xml, TestProject"
xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the UpdateClient.
  ----> System.NullReferenceException : Object reference not set to an
instance of an object.


I don't know if the logic for <generate> is broken or I'm doing something
wrong.

Thanks

-- 
Mario Chavez
mario.chavez@gmail.com
http://mario-chavez.decisionesinteligentes.com/

Re: Ibatis from SVN tag problems

Posted by Mario Chavez <ma...@gmail.com>.
Well,

In my tests it fails just trying to create the map for update statament, if
I remove it, i just have a select statement with generate tag, it works, but
it sends a crappy sql code to the server.

Mario

On 2/10/07, Gilles Bayon <ib...@gmail.com> wrote:
>
> The generate tag is a bit messy and not guaranty to worked, fortunately
> you can avoid it.
> Basic statement generation will what is the generated SQL in tbe improved
> in version 3.0.
>
> Have you tried to watch what is the generated SQL in the log ?
>
> --
> Cheers,
> Gilles
>
> <a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>
>



-- 
Mario Chavez
mario.chavez@gmail.com
http://mario-chavez.decisionesinteligentes.com/

Re: Ibatis from SVN tag problems

Posted by Gilles Bayon <ib...@gmail.com>.
The generate tag is a bit messy and not guaranty to worked, fortunately you
can avoid it.
Basic statement generation will be improved in version 3.0.

Have you tried to watch what is the generated SQL in the log ?

-- 
Cheers,
Gilles

<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>

Re: Ibatis from SVN tag problems

Posted by Mario Chavez <ma...@gmail.com>.
Sorry, forgot to say that I'm using .NET 2.0

On 2/8/07, Mario Chavez <ma...@gmail.com> wrote:
>
> Hello;
>
> I'm trying to get a map working but it fails when I use <generate> tag for
> update statement, the error that I get is:
>
> - The error occurred while loading SqlMap.
> - loading update tag
> - The error occurred in <sqlMap embedded=" Maps.Codigos.xml, TestProject"
> xmlns="http://ibatis.apache.org/dataMapper" />.
> - Check the UpdateClient. ---> System.ArgumentOutOfRangeException:
> Specified argument was out of the range of valid values.
> Parameter name: index
>
> My parameter maps is like:
>   <parameterMaps>
>     <parameterMap id="InsertClient" class="Client">
>       <parameter property="Code" column="code"/>
>       <parameter property="Name" column="name"/>
>       <parameter property="RFC" column="RFC"/>
>       <parameter property="DataexchangeID" column="dataexchangeid"/>
>       <parameter property="Enable" column="enable"/>
>       <parameter property="CreatedBy" column="createdby"/>
>       <parameter property="CreatedOn" column="createdon"/>
>       <parameter property="UpdatedBy" column="updatedby"/>
>       <parameter property="UpdatedOn" column="updatedon"/>
>     </parameterMap>
>
>     <parameterMap id="UpdateClient" class="Client" extends="InsertClient">
>
>       <parameter property="ID" column="id"/>
>   </parameterMap>
>   </parameterMaps>
>
> And the statements definition is:
> <statements>
>     <update id="UpdateClient" parameterMap="UpdateClient"
> parameterClass="Client">
>       <generate table="Client" by="ID"/>
>     </update>
>   </statements>
>
> According to documentation 1.6.0 - 3.3.3.4., it should work but it fails.
> On section 3.3.4.3. says that if I do not specify parameterMap it can use
> parameterClass, but if my definition does not have parameterMap it fails
> with:
>
>   ----> IBatisNet.Common.Exceptions.ConfigurationException :
> - The error occurred while loading SqlMap.
> - loading update tag
> - The error occurred in <sqlMap embedded="Maps.Codigos.xml, TestProject"
> xmlns=" http://ibatis.apache.org/dataMapper" />.
> - Check the UpdateClient.
>   ----> System.NullReferenceException : Object reference not set to an
> instance of an object.
>
>
> I don't know if the logic for <generate> is broken or I'm doing something
> wrong.
>
> Thanks
>
> --
> Mario Chavez
> mario.chavez@gmail.com
> http://mario-chavez.decisionesinteligentes.com/




-- 
Mario Chavez
mario.chavez@gmail.com
http://mario-chavez.decisionesinteligentes.com/