<generate> tag not working

View: New views
16 Messages — Rating Filter:   Alert me  

<generate> tag not working

by dannystommen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I'm trying to use parameterMaps with the <generate> tag, but it is not working. I have a databse with table 'test_table' and 2 colums: id & name

  <resultMaps>
    <resultMap id="TestResult" class="Test">
      <result property="ID" column="id" />
      <result property="Name" column="name" />
    </resultMap>
  </resultMaps>

  <parameterMaps>
    <parameterMap id="insert" class="Test">
      <result property="Name" column="name" />
    </parameterMap>

    <parameterMap id="update" class="Test" extends="insert">
      <result property="ID" column="id" />
    </parameterMap>    
  </parameterMaps>

  <statements>  
    <!--Insert description-->
    <insert id="Insert" parameterMap="insert">
      <selectKey property="ID" type="post" resultClass="int">
        select LAST_INSERT_ID() as value
      </selectKey>
      <generate table="test_table" />
    </insert>

    <update id="Update" parameterMap="update">
      <generate table="test_table" by="id" />
    </update>

  </statements>
</sqlMap>

the first error occurs when I try to configure Ibatis (first use). "Specified argument was out of the range of valid values.\r\nParameter name: index". This happens in de update tag. When I comment this generate tag out, the configuration succeeds. Why is this happening, I don't have any parameter that is named 'index'.

Secondly, when I try to execute the insert statement, it fails with the message dat column 'name' has no default value. After some debugging, I saw that ibatis generated the next insert statement: "INSERT INTO test_table () VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES (something_here?)"

Why is this happening?


Re: <generate> tag not working

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well,

One thing I notice that is wrong is your using a result element in your parameter Maps.

Instead of this:
   <parameterMap id="insert" class="Test">
     <result property="Name" column="name" />
   </parameterMap>

Try this:
   <parameterMap id="insert" class="Test">
     <parameter property="Name" column="name" />
   </parameterMap>


On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@...> wrote:

Hi there,

I'm trying to use parameterMaps with the <generate> tag, but it is not
working. I have a databse with table 'test_table' and 2 colums: id & name

 <resultMaps>
   <resultMap id="TestResult" class="Test">
     <result property="ID" column="id" />
     <result property="Name" column="name" />
   </resultMap>
 </resultMaps>

 <parameterMaps>
   <parameterMap id="insert" class="Test">
     <result property="Name" column="name" />
   </parameterMap>

   <parameterMap id="update" class="Test" extends="insert">
     <result property="ID" column="id" />
   </parameterMap>
 </parameterMaps>

 <statements>
   <!--Insert description-->
   <insert id="Insert" parameterMap="insert">
     <selectKey property="ID" type="post" resultClass="int">
       select LAST_INSERT_ID() as value
     </selectKey>
     <generate table="test_table" />
   </insert>

   <update id="Update" parameterMap="update">
     <generate table="test_table" by="id" />
   </update>

 </statements>
</sqlMap>

the first error occurs when I try to configure Ibatis (first use).
"Specified argument was out of the range of valid values.\r\nParameter name:
index". This happens in de update tag. When I comment this generate tag out,
the configuration succeeds. Why is this happening, I don't have any
parameter that is named 'index'.

Secondly, when I try to execute the insert statement, it fails with the
message dat column 'name' has no default value. After some debugging, I saw
that ibatis generated the next insert statement: "INSERT INTO test_table ()
VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES
(something_here?)"

Why is this happening?


--
View this message in context: http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by dannystommen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your fast reply. I changed it, but the result is still the same incorrect sql statement

Michael McCurrey-3 wrote:
Well,

One thing I notice that is wrong is your using a result element in your
parameter Maps.

Instead of this:
   <parameterMap id="insert" class="Test">
     <result property="Name" column="name" />
   </parameterMap>

Try this:
   <parameterMap id="insert" class="Test">
     <parameter property="Name" column="name" />
   </parameterMap>


On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@techconnect.nl> wrote:

>
> Hi there,
>
> I'm trying to use parameterMaps with the <generate> tag, but it is not
> working. I have a databse with table 'test_table' and 2 colums: id & name
>
>  <resultMaps>
>    <resultMap id="TestResult" class="Test">
>      <result property="ID" column="id" />
>      <result property="Name" column="name" />
>    </resultMap>
>  </resultMaps>
>
>  <parameterMaps>
>    <parameterMap id="insert" class="Test">
>      <result property="Name" column="name" />
>    </parameterMap>
>
>    <parameterMap id="update" class="Test" extends="insert">
>      <result property="ID" column="id" />
>    </parameterMap>
>  </parameterMaps>
>
>  <statements>
>    <!--Insert description-->
>    <insert id="Insert" parameterMap="insert">
>      <selectKey property="ID" type="post" resultClass="int">
>        select LAST_INSERT_ID() as value
>      </selectKey>
>      <generate table="test_table" />
>    </insert>
>
>    <update id="Update" parameterMap="update">
>      <generate table="test_table" by="id" />
>    </update>
>
>  </statements>
> </sqlMap>
>
> the first error occurs when I try to configure Ibatis (first use).
> "Specified argument was out of the range of valid values.\r\nParameter
> name:
> index". This happens in de update tag. When I comment this generate tag
> out,
> the configuration succeeds. Why is this happening, I don't have any
> parameter that is named 'index'.
>
> Secondly, when I try to execute the insert statement, it fails with the
> message dat column 'name' has no default value. After some debugging, I saw
> that ibatis generated the next insert statement: "INSERT INTO test_table ()
> VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES
> (something_here?)"
>
> Why is this happening?
>
>
> --
> View this message in context:
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-cs-help@ibatis.apache.org
>
>


--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What version of iBatis?

On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@...> wrote:

Thanks for your fast reply. I changed it, but the result is still the same
incorrect sql statement


Michael McCurrey-3 wrote:
>
> Well,
>
> One thing I notice that is wrong is your using a result element in your
> parameter Maps.
>
> Instead of this:
>    <parameterMap id="insert" class="Test">
>      <result property="Name" column="name" />
>    </parameterMap>
>
> Try this:
>    <parameterMap id="insert" class="Test">
>      <parameter property="Name" column="name" />
>    </parameterMap>
>
>
> On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@...> wrote:
>
>>
>> Hi there,
>>
>> I'm trying to use parameterMaps with the <generate> tag, but it is not
>> working. I have a databse with table 'test_table' and 2 colums: id & name
>>
>>  <resultMaps>
>>    <resultMap id="TestResult" class="Test">
>>      <result property="ID" column="id" />
>>      <result property="Name" column="name" />
>>    </resultMap>
>>  </resultMaps>
>>
>>  <parameterMaps>
>>    <parameterMap id="insert" class="Test">
>>      <result property="Name" column="name" />
>>    </parameterMap>
>>
>>    <parameterMap id="update" class="Test" extends="insert">
>>      <result property="ID" column="id" />
>>    </parameterMap>
>>  </parameterMaps>
>>
>>  <statements>
>>    <!--Insert description-->
>>    <insert id="Insert" parameterMap="insert">
>>      <selectKey property="ID" type="post" resultClass="int">
>>        select LAST_INSERT_ID() as value
>>      </selectKey>
>>      <generate table="test_table" />
>>    </insert>
>>
>>    <update id="Update" parameterMap="update">
>>      <generate table="test_table" by="id" />
>>    </update>
>>
>>  </statements>
>> </sqlMap>
>>
>> the first error occurs when I try to configure Ibatis (first use).
>> "Specified argument was out of the range of valid values.\r\nParameter
>> name:
>> index". This happens in de update tag. When I comment this generate tag
>> out,
>> the configuration succeeds. Why is this happening, I don't have any
>> parameter that is named 'index'.
>>
>> Secondly, when I try to execute the insert statement, it fails with the
>> message dat column 'name' has no default value. After some debugging, I
>> saw
>> that ibatis generated the next insert statement: "INSERT INTO test_table
>> ()
>> VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES
>> (something_here?)"
>>
>> Why is this happening?
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
>> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> For additional commands, e-mail: user-cs-help@...
>>
>>
>
>
> --
> Michael J. McCurrey
> Read with me at http://www.mccurrey.com
> http://chaoticmindramblings.blogspot.com/
>
>

--
View this message in context: http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by dannystommen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Version 1.6.1

Michael McCurrey-3 wrote:
What version of iBatis?

On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@techconnect.nl> wrote:

>
> Thanks for your fast reply. I changed it, but the result is still the same
> incorrect sql statement
>
>
> Michael McCurrey-3 wrote:
> >
> > Well,
> >
> > One thing I notice that is wrong is your using a result element in your
> > parameter Maps.
> >
> > Instead of this:
> >    <parameterMap id="insert" class="Test">
> >      <result property="Name" column="name" />
> >    </parameterMap>
> >
> > Try this:
> >    <parameterMap id="insert" class="Test">
> >      <parameter property="Name" column="name" />
> >    </parameterMap>
> >
> >
> > On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@techconnect.nl>
> wrote:
> >
> >>
> >> Hi there,
> >>
> >> I'm trying to use parameterMaps with the <generate> tag, but it is not
> >> working. I have a databse with table 'test_table' and 2 colums: id &
> name
> >>
> >>  <resultMaps>
> >>    <resultMap id="TestResult" class="Test">
> >>      <result property="ID" column="id" />
> >>      <result property="Name" column="name" />
> >>    </resultMap>
> >>  </resultMaps>
> >>
> >>  <parameterMaps>
> >>    <parameterMap id="insert" class="Test">
> >>      <result property="Name" column="name" />
> >>    </parameterMap>
> >>
> >>    <parameterMap id="update" class="Test" extends="insert">
> >>      <result property="ID" column="id" />
> >>    </parameterMap>
> >>  </parameterMaps>
> >>
> >>  <statements>
> >>    <!--Insert description-->
> >>    <insert id="Insert" parameterMap="insert">
> >>      <selectKey property="ID" type="post" resultClass="int">
> >>        select LAST_INSERT_ID() as value
> >>      </selectKey>
> >>      <generate table="test_table" />
> >>    </insert>
> >>
> >>    <update id="Update" parameterMap="update">
> >>      <generate table="test_table" by="id" />
> >>    </update>
> >>
> >>  </statements>
> >> </sqlMap>
> >>
> >> the first error occurs when I try to configure Ibatis (first use).
> >> "Specified argument was out of the range of valid values.\r\nParameter
> >> name:
> >> index". This happens in de update tag. When I comment this generate tag
> >> out,
> >> the configuration succeeds. Why is this happening, I don't have any
> >> parameter that is named 'index'.
> >>
> >> Secondly, when I try to execute the insert statement, it fails with the
> >> message dat column 'name' has no default value. After some debugging, I
> >> saw
> >> that ibatis generated the next insert statement: "INSERT INTO test_table
> >> ()
> >> VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES
> >> (something_here?)"
> >>
> >> Why is this happening?
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-cs-help@ibatis.apache.org
> >>
> >>
> >
> >
> > --
> > Michael J. McCurrey
> > Read with me at http://www.mccurrey.com
> > http://chaoticmindramblings.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-cs-help@ibatis.apache.org
>
>


--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can you update to 1.6.3 and see if it works, if not, send me your updated map file and I'll take a look.  Did you change the <result for both your insert and your update map?


On Tue, Sep 1, 2009 at 8:18 AM, dannystommen <danny@...> wrote:

Version 1.6.1


Michael McCurrey-3 wrote:
>
> What version of iBatis?
>
> On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@...> wrote:
>
>>
>> Thanks for your fast reply. I changed it, but the result is still the
>> same
>> incorrect sql statement
>>
>>
>> Michael McCurrey-3 wrote:
>> >
>> > Well,
>> >
>> > One thing I notice that is wrong is your using a result element in your
>> > parameter Maps.
>> >
>> > Instead of this:
>> >    <parameterMap id="insert" class="Test">
>> >      <result property="Name" column="name" />
>> >    </parameterMap>
>> >
>> > Try this:
>> >    <parameterMap id="insert" class="Test">
>> >      <parameter property="Name" column="name" />
>> >    </parameterMap>
>> >
>> >
>> > On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@...>
>> wrote:
>> >
>> >>
>> >> Hi there,
>> >>
>> >> I'm trying to use parameterMaps with the <generate> tag, but it is not
>> >> working. I have a databse with table 'test_table' and 2 colums: id &
>> name
>> >>
>> >>  <resultMaps>
>> >>    <resultMap id="TestResult" class="Test">
>> >>      <result property="ID" column="id" />
>> >>      <result property="Name" column="name" />
>> >>    </resultMap>
>> >>  </resultMaps>
>> >>
>> >>  <parameterMaps>
>> >>    <parameterMap id="insert" class="Test">
>> >>      <result property="Name" column="name" />
>> >>    </parameterMap>
>> >>
>> >>    <parameterMap id="update" class="Test" extends="insert">
>> >>      <result property="ID" column="id" />
>> >>    </parameterMap>
>> >>  </parameterMaps>
>> >>
>> >>  <statements>
>> >>    <!--Insert description-->
>> >>    <insert id="Insert" parameterMap="insert">
>> >>      <selectKey property="ID" type="post" resultClass="int">
>> >>        select LAST_INSERT_ID() as value
>> >>      </selectKey>
>> >>      <generate table="test_table" />
>> >>    </insert>
>> >>
>> >>    <update id="Update" parameterMap="update">
>> >>      <generate table="test_table" by="id" />
>> >>    </update>
>> >>
>> >>  </statements>
>> >> </sqlMap>
>> >>
>> >> the first error occurs when I try to configure Ibatis (first use).
>> >> "Specified argument was out of the range of valid values.\r\nParameter
>> >> name:
>> >> index". This happens in de update tag. When I comment this generate
>> tag
>> >> out,
>> >> the configuration succeeds. Why is this happening, I don't have any
>> >> parameter that is named 'index'.
>> >>
>> >> Secondly, when I try to execute the insert statement, it fails with
>> the
>> >> message dat column 'name' has no default value. After some debugging,
>> I
>> >> saw
>> >> that ibatis generated the next insert statement: "INSERT INTO
>> test_table
>> >> ()
>> >> VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES
>> >> (something_here?)"
>> >>
>> >> Why is this happening?
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
>> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> >> For additional commands, e-mail: user-cs-help@...
>> >>
>> >>
>> >
>> >
>> > --
>> > Michael J. McCurrey
>> > Read with me at http://www.mccurrey.com
>> > http://chaoticmindramblings.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
>> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> For additional commands, e-mail: user-cs-help@...
>>
>>
>
>
> --
> Michael J. McCurrey
> Read with me at http://www.mccurrey.com
> http://chaoticmindramblings.blogspot.com/
>
>

--
View this message in context: http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242269.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think I meant 1.6.2, 1.6.3 is in the works..

On Tue, Sep 1, 2009 at 8:22 AM, Michael McCurrey <mmccurrey@...> wrote:
Can you update to 1.6.3 and see if it works, if not, send me your updated map file and I'll take a look.  Did you change the <result for both your insert and your update map?



On Tue, Sep 1, 2009 at 8:18 AM, dannystommen <danny@...> wrote:

Version 1.6.1


Michael McCurrey-3 wrote:
>
> What version of iBatis?
>
> On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@...> wrote:
>
>>
>> Thanks for your fast reply. I changed it, but the result is still the
>> same
>> incorrect sql statement
>>
>>
>> Michael McCurrey-3 wrote:
>> >
>> > Well,
>> >
>> > One thing I notice that is wrong is your using a result element in your
>> > parameter Maps.
>> >
>> > Instead of this:
>> >    <parameterMap id="insert" class="Test">
>> >      <result property="Name" column="name" />
>> >    </parameterMap>
>> >
>> > Try this:
>> >    <parameterMap id="insert" class="Test">
>> >      <parameter property="Name" column="name" />
>> >    </parameterMap>
>> >
>> >
>> > On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@...>
>> wrote:
>> >
>> >>
>> >> Hi there,
>> >>
>> >> I'm trying to use parameterMaps with the <generate> tag, but it is not
>> >> working. I have a databse with table 'test_table' and 2 colums: id &
>> name
>> >>
>> >>  <resultMaps>
>> >>    <resultMap id="TestResult" class="Test">
>> >>      <result property="ID" column="id" />
>> >>      <result property="Name" column="name" />
>> >>    </resultMap>
>> >>  </resultMaps>
>> >>
>> >>  <parameterMaps>
>> >>    <parameterMap id="insert" class="Test">
>> >>      <result property="Name" column="name" />
>> >>    </parameterMap>
>> >>
>> >>    <parameterMap id="update" class="Test" extends="insert">
>> >>      <result property="ID" column="id" />
>> >>    </parameterMap>
>> >>  </parameterMaps>
>> >>
>> >>  <statements>
>> >>    <!--Insert description-->
>> >>    <insert id="Insert" parameterMap="insert">
>> >>      <selectKey property="ID" type="post" resultClass="int">
>> >>        select LAST_INSERT_ID() as value
>> >>      </selectKey>
>> >>      <generate table="test_table" />
>> >>    </insert>
>> >>
>> >>    <update id="Update" parameterMap="update">
>> >>      <generate table="test_table" by="id" />
>> >>    </update>
>> >>
>> >>  </statements>
>> >> </sqlMap>
>> >>
>> >> the first error occurs when I try to configure Ibatis (first use).
>> >> "Specified argument was out of the range of valid values.\r\nParameter
>> >> name:
>> >> index". This happens in de update tag. When I comment this generate
>> tag
>> >> out,
>> >> the configuration succeeds. Why is this happening, I don't have any
>> >> parameter that is named 'index'.
>> >>
>> >> Secondly, when I try to execute the insert statement, it fails with
>> the
>> >> message dat column 'name' has no default value. After some debugging,
>> I
>> >> saw
>> >> that ibatis generated the next insert statement: "INSERT INTO
>> test_table
>> >> ()
>> >> VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES
>> >> (something_here?)"
>> >>
>> >> Why is this happening?
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
>> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> >> For additional commands, e-mail: user-cs-help@...
>> >>
>> >>
>> >
>> >
>> > --
>> > Michael J. McCurrey
>> > Read with me at http://www.mccurrey.com
>> > http://chaoticmindramblings.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
>> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> For additional commands, e-mail: user-cs-help@...
>>
>>
>
>
> --
> Michael J. McCurrey
> Read with me at http://www.mccurrey.com
> http://chaoticmindramblings.blogspot.com/
>
>

--
View this message in context: http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242269.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--



--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by dannystommen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Where can 1.6.3 be found? On ibatis.apache.org I can only find 1.6.2. I upgraded to this version. Still doesn't work

My XML
<?xml version="1.0" encoding="UTF-8"?>
<sqlMap namespace="Test" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ibatis.apache.org/mapping ../Config/SqlMap.xsd ">
  <resultMaps>
    <resultMap id="TestResult" class="Test">
      <result property="ID" column="id" />
      <result property="Name" column="name" />
    </resultMap>
  </resultMaps>

  <parameterMaps>
    <parameterMap id="insert" class="Test">
      <paramater property="Name" column="name" />
    </parameterMap>

    <parameterMap id="update" class="Test" extends="insert">
      <paramater property="ID" column="id" />
    </parameterMap>    
  </parameterMaps>
 
 
  <statements>  
    <insert id="Insert" parameterMap="insert">
      <selectKey property="ID" type="post" resultClass="int">
        select LAST_INSERT_ID() as value
      </selectKey>
      <generate table="test_table" />
    </insert>

    <update id="Update" parameterMap="update">
      <generate table="test_table" by="id"></generate>
    </update>

  </statements>
</sqlMap>



Michael McCurrey-3 wrote:
Can you update to 1.6.3 and see if it works, if not, send me your updated
map file and I'll take a look.  Did you change the <result for both your
insert and your update map?


On Tue, Sep 1, 2009 at 8:18 AM, dannystommen <danny@techconnect.nl> wrote:

>
> Version 1.6.1
>
>
> Michael McCurrey-3 wrote:
> >
> > What version of iBatis?
> >
> > On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@techconnect.nl>
> wrote:
> >
> >>
> >> Thanks for your fast reply. I changed it, but the result is still the
> >> same
> >> incorrect sql statement
> >>
> >>
> >> Michael McCurrey-3 wrote:
> >> >
> >> > Well,
> >> >
> >> > One thing I notice that is wrong is your using a result element in
> your
> >> > parameter Maps.
> >> >
> >> > Instead of this:
> >> >    <parameterMap id="insert" class="Test">
> >> >      <result property="Name" column="name" />
> >> >    </parameterMap>
> >> >
> >> > Try this:
> >> >    <parameterMap id="insert" class="Test">
> >> >      <parameter property="Name" column="name" />
> >> >    </parameterMap>
> >> >
> >> >
> >> > On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@techconnect.nl>
> >> wrote:
> >> >
> >> >>
> >> >> Hi there,
> >> >>
> >> >> I'm trying to use parameterMaps with the <generate> tag, but it is
> not
> >> >> working. I have a databse with table 'test_table' and 2 colums: id &
> >> name
> >> >>
> >> >>  <resultMaps>
> >> >>    <resultMap id="TestResult" class="Test">
> >> >>      <result property="ID" column="id" />
> >> >>      <result property="Name" column="name" />
> >> >>    </resultMap>
> >> >>  </resultMaps>
> >> >>
> >> >>  <parameterMaps>
> >> >>    <parameterMap id="insert" class="Test">
> >> >>      <result property="Name" column="name" />
> >> >>    </parameterMap>
> >> >>
> >> >>    <parameterMap id="update" class="Test" extends="insert">
> >> >>      <result property="ID" column="id" />
> >> >>    </parameterMap>
> >> >>  </parameterMaps>
> >> >>
> >> >>  <statements>
> >> >>    <!--Insert description-->
> >> >>    <insert id="Insert" parameterMap="insert">
> >> >>      <selectKey property="ID" type="post" resultClass="int">
> >> >>        select LAST_INSERT_ID() as value
> >> >>      </selectKey>
> >> >>      <generate table="test_table" />
> >> >>    </insert>
> >> >>
> >> >>    <update id="Update" parameterMap="update">
> >> >>      <generate table="test_table" by="id" />
> >> >>    </update>
> >> >>
> >> >>  </statements>
> >> >> </sqlMap>
> >> >>
> >> >> the first error occurs when I try to configure Ibatis (first use).
> >> >> "Specified argument was out of the range of valid
> values.\r\nParameter
> >> >> name:
> >> >> index". This happens in de update tag. When I comment this generate
> >> tag
> >> >> out,
> >> >> the configuration succeeds. Why is this happening, I don't have any
> >> >> parameter that is named 'index'.
> >> >>
> >> >> Secondly, when I try to execute the insert statement, it fails with
> >> the
> >> >> message dat column 'name' has no default value. After some debugging,
> >> I
> >> >> saw
> >> >> that ibatis generated the next insert statement: "INSERT INTO
> >> test_table
> >> >> ()
> >> >> VALUES ()", while it should be: "INSERT INTO test_table (name) VALUES
> >> >> (something_here?)"
> >> >>
> >> >> Why is this happening?
> >> >>
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
> >> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> >> >> For additional commands, e-mail: user-cs-help@ibatis.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Michael J. McCurrey
> >> > Read with me at http://www.mccurrey.com
> >> > http://chaoticmindramblings.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-cs-help@ibatis.apache.org
> >>
> >>
> >
> >
> > --
> > Michael J. McCurrey
> > Read with me at http://www.mccurrey.com
> > http://chaoticmindramblings.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242269.html
> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-cs-help@ibatis.apache.org
>
>


--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'll take a look at it tonight Danny.  Stay tuned.

On Wed, Sep 2, 2009 at 12:02 AM, dannystommen <danny@...> wrote:

Where can 1.6.3 be found? On ibatis.apache.org I can only find 1.6.2. I
upgraded to this version. Still doesn't work

My XML
<?xml version="1.0" encoding="UTF-8"?>
<sqlMap namespace="Test" xmlns="http://ibatis.apache.org/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibatis.apache.org/mapping ../Config/SqlMap.xsd ">
 <resultMaps>
   <resultMap id="TestResult" class="Test">
     <result property="ID" column="id" />
     <result property="Name" column="name" />
   </resultMap>
 </resultMaps>

 <parameterMaps>
   <parameterMap id="insert" class="Test">
     <paramater property="Name" column="name" />
   </parameterMap>

   <parameterMap id="update" class="Test" extends="insert">
     <paramater property="ID" column="id" />
   </parameterMap>
 </parameterMaps>


 <statements>
   <insert id="Insert" parameterMap="insert">
     <selectKey property="ID" type="post" resultClass="int">
       select LAST_INSERT_ID() as value
     </selectKey>
     <generate table="test_table" />
   </insert>

   <update id="Update" parameterMap="update">
     <generate table="test_table" by="id"></generate>
   </update>

 </statements>
</sqlMap>




Michael McCurrey-3 wrote:
>
> Can you update to 1.6.3 and see if it works, if not, send me your updated
> map file and I'll take a look.  Did you change the <result for both your
> insert and your update map?
>
>
> On Tue, Sep 1, 2009 at 8:18 AM, dannystommen <danny@...> wrote:
>
>>
>> Version 1.6.1
>>
>>
>> Michael McCurrey-3 wrote:
>> >
>> > What version of iBatis?
>> >
>> > On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@...>
>> wrote:
>> >
>> >>
>> >> Thanks for your fast reply. I changed it, but the result is still the
>> >> same
>> >> incorrect sql statement
>> >>
>> >>
>> >> Michael McCurrey-3 wrote:
>> >> >
>> >> > Well,
>> >> >
>> >> > One thing I notice that is wrong is your using a result element in
>> your
>> >> > parameter Maps.
>> >> >
>> >> > Instead of this:
>> >> >    <parameterMap id="insert" class="Test">
>> >> >      <result property="Name" column="name" />
>> >> >    </parameterMap>
>> >> >
>> >> > Try this:
>> >> >    <parameterMap id="insert" class="Test">
>> >> >      <parameter property="Name" column="name" />
>> >> >    </parameterMap>
>> >> >
>> >> >
>> >> > On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@...>
>> >> wrote:
>> >> >
>> >> >>
>> >> >> Hi there,
>> >> >>
>> >> >> I'm trying to use parameterMaps with the <generate> tag, but it is
>> not
>> >> >> working. I have a databse with table 'test_table' and 2 colums: id
>> &
>> >> name
>> >> >>
>> >> >>  <resultMaps>
>> >> >>    <resultMap id="TestResult" class="Test">
>> >> >>      <result property="ID" column="id" />
>> >> >>      <result property="Name" column="name" />
>> >> >>    </resultMap>
>> >> >>  </resultMaps>
>> >> >>
>> >> >>  <parameterMaps>
>> >> >>    <parameterMap id="insert" class="Test">
>> >> >>      <result property="Name" column="name" />
>> >> >>    </parameterMap>
>> >> >>
>> >> >>    <parameterMap id="update" class="Test" extends="insert">
>> >> >>      <result property="ID" column="id" />
>> >> >>    </parameterMap>
>> >> >>  </parameterMaps>
>> >> >>
>> >> >>  <statements>
>> >> >>    <!--Insert description-->
>> >> >>    <insert id="Insert" parameterMap="insert">
>> >> >>      <selectKey property="ID" type="post" resultClass="int">
>> >> >>        select LAST_INSERT_ID() as value
>> >> >>      </selectKey>
>> >> >>      <generate table="test_table" />
>> >> >>    </insert>
>> >> >>
>> >> >>    <update id="Update" parameterMap="update">
>> >> >>      <generate table="test_table" by="id" />
>> >> >>    </update>
>> >> >>
>> >> >>  </statements>
>> >> >> </sqlMap>
>> >> >>
>> >> >> the first error occurs when I try to configure Ibatis (first use).
>> >> >> "Specified argument was out of the range of valid
>> values.\r\nParameter
>> >> >> name:
>> >> >> index". This happens in de update tag. When I comment this generate
>> >> tag
>> >> >> out,
>> >> >> the configuration succeeds. Why is this happening, I don't have any
>> >> >> parameter that is named 'index'.
>> >> >>
>> >> >> Secondly, when I try to execute the insert statement, it fails with
>> >> the
>> >> >> message dat column 'name' has no default value. After some
>> debugging,
>> >> I
>> >> >> saw
>> >> >> that ibatis generated the next insert statement: "INSERT INTO
>> >> test_table
>> >> >> ()
>> >> >> VALUES ()", while it should be: "INSERT INTO test_table (name)
>> VALUES
>> >> >> (something_here?)"
>> >> >>
>> >> >> Why is this happening?
>> >> >>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
>> >> >> Sent from the iBATIS - User - Cs mailing list archive at
>> Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> >> >> For additional commands, e-mail: user-cs-help@...
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Michael J. McCurrey
>> >> > Read with me at http://www.mccurrey.com
>> >> > http://chaoticmindramblings.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
>> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> >> For additional commands, e-mail: user-cs-help@...
>> >>
>> >>
>> >
>> >
>> > --
>> > Michael J. McCurrey
>> > Read with me at http://www.mccurrey.com
>> > http://chaoticmindramblings.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242269.html
>> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> For additional commands, e-mail: user-cs-help@...
>>
>>
>
>
> --
> Michael J. McCurrey
> Read with me at http://www.mccurrey.com
> http://chaoticmindramblings.blogspot.com/
>
>

--
View this message in context: http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25252614.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by dannystommen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael, did you manage to take a look at it?

Michael McCurrey-3 wrote:
I'll take a look at it tonight Danny.  Stay tuned.

On Wed, Sep 2, 2009 at 12:02 AM, dannystommen <danny@techconnect.nl> wrote:

>
> Where can 1.6.3 be found? On ibatis.apache.org I can only find 1.6.2. I
> upgraded to this version. Still doesn't work
>
> My XML
> <?xml version="1.0" encoding="UTF-8"?>
> <sqlMap namespace="Test" xmlns="http://ibatis.apache.org/mapping"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://ibatis.apache.org/mapping ../Config/SqlMap.xsd
> ">
>   <resultMaps>
>    <resultMap id="TestResult" class="Test">
>      <result property="ID" column="id" />
>      <result property="Name" column="name" />
>    </resultMap>
>  </resultMaps>
>
>  <parameterMaps>
>    <parameterMap id="insert" class="Test">
>       <paramater property="Name" column="name" />
>     </parameterMap>
>
>    <parameterMap id="update" class="Test" extends="insert">
>       <paramater property="ID" column="id" />
>    </parameterMap>
>  </parameterMaps>
>
>
>  <statements>
>     <insert id="Insert" parameterMap="insert">
>      <selectKey property="ID" type="post" resultClass="int">
>        select LAST_INSERT_ID() as value
>      </selectKey>
>      <generate table="test_table" />
>    </insert>
>
>    <update id="Update" parameterMap="update">
>       <generate table="test_table" by="id"></generate>
>    </update>
>
>  </statements>
> </sqlMap>
>
>
>
>
> Michael McCurrey-3 wrote:
> >
> > Can you update to 1.6.3 and see if it works, if not, send me your updated
> > map file and I'll take a look.  Did you change the <result for both your
> > insert and your update map?
> >
> >
> > On Tue, Sep 1, 2009 at 8:18 AM, dannystommen <danny@techconnect.nl>
> wrote:
> >
> >>
> >> Version 1.6.1
> >>
> >>
> >> Michael McCurrey-3 wrote:
> >> >
> >> > What version of iBatis?
> >> >
> >> > On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@techconnect.nl>
> >> wrote:
> >> >
> >> >>
> >> >> Thanks for your fast reply. I changed it, but the result is still the
> >> >> same
> >> >> incorrect sql statement
> >> >>
> >> >>
> >> >> Michael McCurrey-3 wrote:
> >> >> >
> >> >> > Well,
> >> >> >
> >> >> > One thing I notice that is wrong is your using a result element in
> >> your
> >> >> > parameter Maps.
> >> >> >
> >> >> > Instead of this:
> >> >> >    <parameterMap id="insert" class="Test">
> >> >> >      <result property="Name" column="name" />
> >> >> >    </parameterMap>
> >> >> >
> >> >> > Try this:
> >> >> >    <parameterMap id="insert" class="Test">
> >> >> >      <parameter property="Name" column="name" />
> >> >> >    </parameterMap>
> >> >> >
> >> >> >
> >> >> > On Tue, Sep 1, 2009 at 6:07 AM, dannystommen <danny@techconnect.nl
> >
> >> >> wrote:
> >> >> >
> >> >> >>
> >> >> >> Hi there,
> >> >> >>
> >> >> >> I'm trying to use parameterMaps with the <generate> tag, but it is
> >> not
> >> >> >> working. I have a databse with table 'test_table' and 2 colums: id
> >> &
> >> >> name
> >> >> >>
> >> >> >>  <resultMaps>
> >> >> >>    <resultMap id="TestResult" class="Test">
> >> >> >>      <result property="ID" column="id" />
> >> >> >>      <result property="Name" column="name" />
> >> >> >>    </resultMap>
> >> >> >>  </resultMaps>
> >> >> >>
> >> >> >>  <parameterMaps>
> >> >> >>    <parameterMap id="insert" class="Test">
> >> >> >>      <result property="Name" column="name" />
> >> >> >>    </parameterMap>
> >> >> >>
> >> >> >>    <parameterMap id="update" class="Test" extends="insert">
> >> >> >>      <result property="ID" column="id" />
> >> >> >>    </parameterMap>
> >> >> >>  </parameterMaps>
> >> >> >>
> >> >> >>  <statements>
> >> >> >>    <!--Insert description-->
> >> >> >>    <insert id="Insert" parameterMap="insert">
> >> >> >>      <selectKey property="ID" type="post" resultClass="int">
> >> >> >>        select LAST_INSERT_ID() as value
> >> >> >>      </selectKey>
> >> >> >>      <generate table="test_table" />
> >> >> >>    </insert>
> >> >> >>
> >> >> >>    <update id="Update" parameterMap="update">
> >> >> >>      <generate table="test_table" by="id" />
> >> >> >>    </update>
> >> >> >>
> >> >> >>  </statements>
> >> >> >> </sqlMap>
> >> >> >>
> >> >> >> the first error occurs when I try to configure Ibatis (first use).
> >> >> >> "Specified argument was out of the range of valid
> >> values.\r\nParameter
> >> >> >> name:
> >> >> >> index". This happens in de update tag. When I comment this
> generate
> >> >> tag
> >> >> >> out,
> >> >> >> the configuration succeeds. Why is this happening, I don't have
> any
> >> >> >> parameter that is named 'index'.
> >> >> >>
> >> >> >> Secondly, when I try to execute the insert statement, it fails
> with
> >> >> the
> >> >> >> message dat column 'name' has no default value. After some
> >> debugging,
> >> >> I
> >> >> >> saw
> >> >> >> that ibatis generated the next insert statement: "INSERT INTO
> >> >> test_table
> >> >> >> ()
> >> >> >> VALUES ()", while it should be: "INSERT INTO test_table (name)
> >> VALUES
> >> >> >> (something_here?)"
> >> >> >>
> >> >> >> Why is this happening?
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >>
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
> >> >> >> Sent from the iBATIS - User - Cs mailing list archive at
> >> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> >> >> >> For additional commands, e-mail: user-cs-help@ibatis.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Michael J. McCurrey
> >> >> > Read with me at http://www.mccurrey.com
> >> >> > http://chaoticmindramblings.blogspot.com/
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
> >> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> >> >> For additional commands, e-mail: user-cs-help@ibatis.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Michael J. McCurrey
> >> > Read with me at http://www.mccurrey.com
> >> > http://chaoticmindramblings.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242269.html
> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-cs-help@ibatis.apache.org
> >>
> >>
> >
> >
> > --
> > Michael J. McCurrey
> > Read with me at http://www.mccurrey.com
> > http://chaoticmindramblings.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25252614.html
> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-cs-help@ibatis.apache.org
>
>


--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, but I should have asked what DB you were using..

Your Insert is might not working because your passing in your Insert map, but your ID Column/Property is defined in your Update Map.

I also noticed that your column's and properties have different casing in them.  There seems to be a bug in Generate in that its ignoring your parametermap to do the conversion between Property and Column.  For a workaround, set your property to the same casing as the column or vice-versa.  I will address this in 1.6.3


On Thu, Sep 3, 2009 at 2:25 AM, dannystommen <danny@...> wrote:

Michael, did you manage to take a look at it?


Michael McCurrey-3 wrote:
>
> I'll take a look at it tonight Danny.  Stay tuned.
>
> On Wed, Sep 2, 2009 at 12:02 AM, dannystommen <danny@...>
> wrote:
>
>>
>> Where can 1.6.3 be found? On ibatis.apache.org I can only find 1.6.2. I
>> upgraded to this version. Still doesn't work
>>
>> My XML
>> <?xml version="1.0" encoding="UTF-8"?>
>> <sqlMap namespace="Test" xmlns="http://ibatis.apache.org/mapping"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://ibatis.apache.org/mapping ../Config/SqlMap.xsd
>> ">
>>   <resultMaps>
>>    <resultMap id="TestResult" class="Test">
>>      <result property="ID" column="id" />
>>      <result property="Name" column="name" />
>>    </resultMap>
>>  </resultMaps>
>>
>>  <parameterMaps>
>>    <parameterMap id="insert" class="Test">
>>       <paramater property="Name" column="name" />
>>     </parameterMap>
>>
>>    <parameterMap id="update" class="Test" extends="insert">
>>       <paramater property="ID" column="id" />
>>    </parameterMap>
>>  </parameterMaps>
>>
>>
>>  <statements>
>>     <insert id="Insert" parameterMap="insert">
>>      <selectKey property="ID" type="post" resultClass="int">
>>        select LAST_INSERT_ID() as value
>>      </selectKey>
>>      <generate table="test_table" />
>>    </insert>
>>
>>    <update id="Update" parameterMap="update">
>>       <generate table="test_table" by="id"></generate>
>>    </update>
>>
>>  </statements>
>> </sqlMap>
>>
>>
>>
>>
>> Michael McCurrey-3 wrote:
>> >
>> > Can you update to 1.6.3 and see if it works, if not, send me your
>> updated
>> > map file and I'll take a look.  Did you change the <result for both
>> your
>> > insert and your update map?
>> >
>> >
>> > On Tue, Sep 1, 2009 at 8:18 AM, dannystommen <danny@...>
>> wrote:
>> >
>> >>
>> >> Version 1.6.1
>> >>
>> >>
>> >> Michael McCurrey-3 wrote:
>> >> >
>> >> > What version of iBatis?
>> >> >
>> >> > On Tue, Sep 1, 2009 at 8:12 AM, dannystommen <danny@...>
>> >> wrote:
>> >> >
>> >> >>
>> >> >> Thanks for your fast reply. I changed it, but the result is still
>> the
>> >> >> same
>> >> >> incorrect sql statement
>> >> >>
>> >> >>
>> >> >> Michael McCurrey-3 wrote:
>> >> >> >
>> >> >> > Well,
>> >> >> >
>> >> >> > One thing I notice that is wrong is your using a result element
>> in
>> >> your
>> >> >> > parameter Maps.
>> >> >> >
>> >> >> > Instead of this:
>> >> >> >    <parameterMap id="insert" class="Test">
>> >> >> >      <result property="Name" column="name" />
>> >> >> >    </parameterMap>
>> >> >> >
>> >> >> > Try this:
>> >> >> >    <parameterMap id="insert" class="Test">
>> >> >> >      <parameter property="Name" column="name" />
>> >> >> >    </parameterMap>
>> >> >> >
>> >> >> >
>> >> >> > On Tue, Sep 1, 2009 at 6:07 AM, dannystommen
>> <danny@...
>> >
>> >> >> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> Hi there,
>> >> >> >>
>> >> >> >> I'm trying to use parameterMaps with the <generate> tag, but it
>> is
>> >> not
>> >> >> >> working. I have a databse with table 'test_table' and 2 colums:
>> id
>> >> &
>> >> >> name
>> >> >> >>
>> >> >> >>  <resultMaps>
>> >> >> >>    <resultMap id="TestResult" class="Test">
>> >> >> >>      <result property="ID" column="id" />
>> >> >> >>      <result property="Name" column="name" />
>> >> >> >>    </resultMap>
>> >> >> >>  </resultMaps>
>> >> >> >>
>> >> >> >>  <parameterMaps>
>> >> >> >>    <parameterMap id="insert" class="Test">
>> >> >> >>      <result property="Name" column="name" />
>> >> >> >>    </parameterMap>
>> >> >> >>
>> >> >> >>    <parameterMap id="update" class="Test" extends="insert">
>> >> >> >>      <result property="ID" column="id" />
>> >> >> >>    </parameterMap>
>> >> >> >>  </parameterMaps>
>> >> >> >>
>> >> >> >>  <statements>
>> >> >> >>    <!--Insert description-->
>> >> >> >>    <insert id="Insert" parameterMap="insert">
>> >> >> >>      <selectKey property="ID" type="post" resultClass="int">
>> >> >> >>        select LAST_INSERT_ID() as value
>> >> >> >>      </selectKey>
>> >> >> >>      <generate table="test_table" />
>> >> >> >>    </insert>
>> >> >> >>
>> >> >> >>    <update id="Update" parameterMap="update">
>> >> >> >>      <generate table="test_table" by="id" />
>> >> >> >>    </update>
>> >> >> >>
>> >> >> >>  </statements>
>> >> >> >> </sqlMap>
>> >> >> >>
>> >> >> >> the first error occurs when I try to configure Ibatis (first
>> use).
>> >> >> >> "Specified argument was out of the range of valid
>> >> values.\r\nParameter
>> >> >> >> name:
>> >> >> >> index". This happens in de update tag. When I comment this
>> generate
>> >> >> tag
>> >> >> >> out,
>> >> >> >> the configuration succeeds. Why is this happening, I don't have
>> any
>> >> >> >> parameter that is named 'index'.
>> >> >> >>
>> >> >> >> Secondly, when I try to execute the insert statement, it fails
>> with
>> >> >> the
>> >> >> >> message dat column 'name' has no default value. After some
>> >> debugging,
>> >> >> I
>> >> >> >> saw
>> >> >> >> that ibatis generated the next insert statement: "INSERT INTO
>> >> >> test_table
>> >> >> >> ()
>> >> >> >> VALUES ()", while it should be: "INSERT INTO test_table (name)
>> >> VALUES
>> >> >> >> (something_here?)"
>> >> >> >>
>> >> >> >> Why is this happening?
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25240019.html
>> >> >> >> Sent from the iBATIS - User - Cs mailing list archive at
>> >> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> >> >> >> For additional commands, e-mail: user-cs-help@...
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Michael J. McCurrey
>> >> >> > Read with me at http://www.mccurrey.com
>> >> >> > http://chaoticmindramblings.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242101.html
>> >> >> Sent from the iBATIS - User - Cs mailing list archive at
>> Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> >> >> For additional commands, e-mail: user-cs-help@...
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Michael J. McCurrey
>> >> > Read with me at http://www.mccurrey.com
>> >> > http://chaoticmindramblings.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25242269.html
>> >> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> >> For additional commands, e-mail: user-cs-help@...
>> >>
>> >>
>> >
>> >
>> > --
>> > Michael J. McCurrey
>> > Read with me at http://www.mccurrey.com
>> > http://chaoticmindramblings.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25252614.html
>> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-cs-unsubscribe@...
>> For additional commands, e-mail: user-cs-help@...
>>
>>
>
>
> --
> Michael J. McCurrey
> Read with me at http://www.mccurrey.com
> http://chaoticmindramblings.blogspot.com/
>
>

--
View this message in context: http://www.nabble.com/%3Cgenerate%3E-tag-not-working-tp25240019p25272516.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: <generate> tag not working

by dannystommen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael McCurrey-3 wrote:
Yes, but I should have asked what DB you were using..
Database: MySQL 5.1


Michael McCurrey-3 wrote:
Your Insert is might not working because your passing in your Insert map,
but your ID Column/Property is defined in your Update Map.
That's because the id column is AutoIncrement. That means that the generated SQL should be "INSERT INTO test_table (name) VALUES (#name)", but it is INSERT INTO test_table() VALUES ()". So the name property isn't used.

Michael McCurrey-3 wrote:
I also noticed that your column's and properties have different casing in
them.  There seems to be a bug in Generate in that its ignoring your
parametermap to do the conversion between Property and Column.  For a
workaround, set your property to the same casing as the column or
vice-versa.  I will address this in 1.6.3
I changed the casing in both Property as Column to lower, but still doesn't work

Feature request: include inside iterate

by Andrea Tassinari :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've never felt the urge of having the tag <include refid=.... inside an
iterate tag. Well I have a complex query where I have to UNION ALL a
series of subqueries and finally apply a general ORDER BY. I'm used to
group all the select field names in a sql tag and then have select
statements like this one:

SELECT <include refid="SelectFields" />
FROM ....

Now, I implemented the union ALL throught out an iterate tag which does
not support the include. which is a pity, isn't it?


--
AndreaT

---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...


Re: Feature request: include inside iterate

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yes.  that is a good one. 

On Mon, Sep 21, 2009 at 11:58 PM, Andrea Tassinari <andreaml@...> wrote:
Hi,

I've never felt the urge of having the tag <include refid=.... inside an iterate tag. Well I have a complex query where I have to UNION ALL a series of subqueries and finally apply a general ORDER BY. I'm used to group all the select field names in a sql tag and then have select statements like this one:

SELECT <include refid="SelectFields" />
FROM ....

Now, I implemented the union ALL throught out an iterate tag which does not support the include. which is a pity, isn't it?


--
AndreaT

---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: Feature request: include inside iterate

by dannystommen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What exactly has this to do with my problem?

Michael McCurrey-3 wrote:
yes.  that is a good one.

On Mon, Sep 21, 2009 at 11:58 PM, Andrea Tassinari <
andreaml@i-mconsulting.com> wrote:

> Hi,
>
> I've never felt the urge of having the tag <include refid=.... inside an
> iterate tag. Well I have a complex query where I have to UNION ALL a series
> of subqueries and finally apply a general ORDER BY. I'm used to group all
> the select field names in a sql tag and then have select statements like
> this one:
>
> SELECT <include refid="SelectFields" />
> FROM ....
>
> Now, I implemented the union ALL throught out an iterate tag which does not
> support the include. which is a pity, isn't it?
>
>
> --
> AndreaT
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-cs-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-cs-help@ibatis.apache.org
>
>


--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: Feature request: include inside iterate

by Andrea Tassinari :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry my fault.

Andrea

dannystommen wrote:

> What exactly has this to do with my problem?
>
>
> Michael McCurrey-3 wrote:
>> yes.  that is a good one.
>>
>> On Mon, Sep 21, 2009 at 11:58 PM, Andrea Tassinari <
>> andreaml@...> wrote:
>>
>>> Hi,
>>>
>>> I've never felt the urge of having the tag <include refid=.... inside an
>>> iterate tag. Well I have a complex query where I have to UNION ALL a
>>> series
>>> of subqueries and finally apply a general ORDER BY. I'm used to group all
>>> the select field names in a sql tag and then have select statements like
>>> this one:
>>>
>>> SELECT <include refid="SelectFields" />
>>> FROM ....
>>>
>>> Now, I implemented the union ALL throught out an iterate tag which does
>>> not
>>> support the include. which is a pity, isn't it?
>>>
>>>
>>> --
>>> AndreaT
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-cs-unsubscribe@...
>>> For additional commands, e-mail: user-cs-help@...
>>>
>>>
>>
>> --
>> Michael J. McCurrey
>> Read with me at http://www.mccurrey.com
>> http://chaoticmindramblings.blogspot.com/
>>
>>
>

--
AndreaT

---------------------------------------------------------------------
To unsubscribe, e-mail: user-cs-unsubscribe@...
For additional commands, e-mail: user-cs-help@...