ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: selectKey problem
Date Tue, 24 Oct 2006 11:47:59 GMT
I am not 100% sure I understand the question...but yes, I think if you
omit the keyProperty attribute, it will work like you want. The insert
method should return the generated key.

Larry


On 10/24/06, Javier Leyba <xleyba@gmail.com> wrote:
> On 10/23/06, Larry Meadors <lmeadors@apache.org> wrote:
> > That message looks iffy at best - I'd try w/o the resultClass on the
> > the <insert> element. It should not needed in any case...same with the
> > type attribute, but you should probably set the keyProperty attribute
> > on the <selectKey> element.
> >
> > So..something like this:
> >
> > <insert id="insertNotification" parameterMap="insertNotificationParam">
> >   insert into blah...
> >   <selectKey resultClass="long" keyProperty="yourIdPropName">
> >     SELECT LAST_INSERT_ID() AS value;
> >   </selectKey>
> > </insert>
> >
>
>
> Thanks for your reply.
>
> I´ll not use generated id in the whole insert, I need to use it in my
> code in other inserts that dependes of this.
>
> Then:
>
> 1 - Could I avoid to keep keyProperty property ?
>
> 2 - Should the insert return my generated id ?
>
> Thanks in advance
>
> J
>

Mime
View raw message