From: | - <grandebuzon(at)gmail(dot)com> |
---|---|
To: | Dave Cramer <pg(at)fastcrypt(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: RETURNING id problem with insert. |
Date: | 2010-12-07 22:57:18 |
Message-ID: | AANLkTikf589Ah5oqAQHHvk-L1V915tTR+R4wKSJ3jDen@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
*no way to return new id with iBatis3 always return - 1 :(*
2010/12/7 Dave Cramer <pg(at)fastcrypt(dot)com>
> On Tue, Dec 7, 2010 at 5:05 PM, - <grandebuzon(at)gmail(dot)com> wrote:
> > With this code, always returns 1 instead of new generated ID
> > <insert id="insertNewItem" parameterType="itemAlias"
> > useGeneratedKeys="true" keyProperty="item_id">
> > INSERT INTO items (
> > category_id,
> > description,
> > ...)
> > VALUES(
> > #{category_id},
> > #{description},
> > ...)
> > </insert>
> > and if I put RETURNING item_id at the end of insert,
> > ......
> > VALUES(
> > #{category_id},
> > #{description},
> > ...) RETURNING item_id
> >
> > </insert>
> >
> > fails with error in the postgres log - syntax error at or near
> "RETURNING"
> > ........$12,
> > $13,
> > $14)
> > RETURNING item_id RETURNING *
>
> It appears that Ibatis added RETURNING * after your RETURNING item_id.
> I'd speak to them to see how to do it properly.
>
> Dave
>
From | Date | Subject | |
---|---|---|---|
Next Message | Mackay, Scott | 2010-12-09 12:09:32 | Status of setQueryTimeout |
Previous Message | Dave Cramer | 2010-12-07 22:12:41 | Re: RETURNING id problem with insert. |