Quantcast

resultType

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

resultType

MSana
I am having one insert mapper like
     <insert id="insertIntoMainTable" parameterType="User">
                <selectKey resultType="long" keyProperty="ID" order="BEFORE">
      SELECT ID_SEQUENCE.NEXTVAL ID FROM DUAL
  </selectKey>
                INSERT INTO S_MAIN_TABLE
                        (ID, USER_NAME, CREATE_DATE)
                VALUES(#{ID},#{userName},SYSDATE)
        </insert>


But after executing this sql, I want to get the ID which is the
sequence number to the calling program (resultType). Can anyone tell
me how can I do this?

Thanks in advance
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: resultType

Larry Meadors
Look at the ID property of the User bean you passed in.

On Sat, Oct 16, 2010 at 6:57 AM, Muqitah <[hidden email]> wrote:

> I am having one insert mapper like
>     <insert id="insertIntoMainTable" parameterType="User">
>                <selectKey resultType="long" keyProperty="ID" order="BEFORE">
>                SELECT ID_SEQUENCE.NEXTVAL ID FROM DUAL
>                </selectKey>
>                INSERT INTO S_MAIN_TABLE
>                        (ID, USER_NAME, CREATE_DATE)
>                VALUES(#{ID},#{userName},SYSDATE)
>        </insert>
>
>
> But after executing this sql, I want to get the ID which is the
> sequence number to the calling program (resultType). Can anyone tell
> me how can I do this?
>
> Thanks in advance
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: resultType

MSana
Thanks For your response. But ID is not a part of User bean. User Bean
just have a userName

On Oct 16, 8:29 am, Larry Meadors <[hidden email]> wrote:

> Look at the ID property of the User bean you passed in.
>
>
>
> On Sat, Oct 16, 2010 at 6:57 AM, Muqitah <[hidden email]> wrote:
> > I am having one insert mapper like
> >     <insert id="insertIntoMainTable" parameterType="User">
> >                <selectKey resultType="long" keyProperty="ID" order="BEFORE">
> >                SELECT ID_SEQUENCE.NEXTVAL ID FROM DUAL
> >                </selectKey>
> >                INSERT INTO S_MAIN_TABLE
> >                        (ID, USER_NAME, CREATE_DATE)
> >                VALUES(#{ID},#{userName},SYSDATE)
> >        </insert>
>
> > But after executing this sql, I want to get the ID which is the
> > sequence number to the calling program (resultType). Can anyone tell
> > me how can I do this?
>
> > Thanks in advance
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: resultType

MSana
Sorry for my earlier response..

I know what you mean. Thanks for your reply

On Oct 16, 8:47 am, Muqitah <[hidden email]> wrote:

> Thanks For your response. But ID is not a part of User bean. User Bean
> just have a userName
>
> On Oct 16, 8:29 am, Larry Meadors <[hidden email]> wrote:
>
>
>
> > Look at the ID property of the User bean you passed in.
>
> > On Sat, Oct 16, 2010 at 6:57 AM, Muqitah <[hidden email]> wrote:
> > > I am having one insert mapper like
> > >     <insert id="insertIntoMainTable" parameterType="User">
> > >                <selectKey resultType="long" keyProperty="ID" order="BEFORE">
> > >                SELECT ID_SEQUENCE.NEXTVAL ID FROM DUAL
> > >                </selectKey>
> > >                INSERT INTO S_MAIN_TABLE
> > >                        (ID, USER_NAME, CREATE_DATE)
> > >                VALUES(#{ID},#{userName},SYSDATE)
> > >        </insert>
>
> > > But after executing this sql, I want to get the ID which is the
> > > sequence number to the calling program (resultType). Can anyone tell
> > > me how can I do this?
>
> > > Thanks in advance
Loading...