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 <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/