One solution that's guaranteed to work - get rid of the parameterMap. You don't need to use parameterMaps unless you are calling stored procedures.
If you really want to use parameterMaps, then you need to change the syntax of your insert statement...it should be like this:
<insert id="x" parameterMap="meMap">
<selectKey resultClass="long" keyProperty="id">
select mytable_seq.nextval from dual
</selectKey>
insert into table(id, name)
(?, ?)
</insert>
Try this and see if it makes a difference.
<selectKey resultClass="long" keyProperty="id">
select mytable_seq.nextval from dual
</selectKey>
insert into table(id, name)
(?, ?)
</insert>
Try this and see if it makes a difference.
Jeff Butler
On 6/9/06, Steven Pannell <[EMAIL PROTECTED]> wrote:
Hi,
I am unable to get the <selectKey> option working with a parameter map. say
I have this:
<parameterMap id="meMap" .....>
<parameter property="id">
<parameter property="name">
</parameterMap>
<insert id="x" parameterMap="meMap">
<selectKey resultClass="long" keyProperty="id">
select mytable_seq.nextval from dual
</selectKey>
insert into table(id, name)
(#id#, #name#)
</insert>
Running this I get an error because the insert reads the ID from the map and
not the selectKey value. Anyone know how I can fix this problem. Removing
the ID from the map did help because then it does not find the ID in the
map! (different error, same problem) when I use a parameterMap in my insert
statement the selectKey is just ignored. Any solutions to this?
thx.
Steve.
