From: | - <grandebuzon(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | mybatis 3 RETURNING id problem with insert. |
Date: | 2010-12-08 07:27:59 |
Message-ID: | AANLkTinWGYDVgWjG4K2CQpzQb82Kw18FC90tbd2286PP@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello.
Iam trying to do an insert for return generated id INSERT RETURNING
id. In postgres editor it work without problems, but in code execution
- java 1.6 with iBatis 3 (mybatis-3.0.3.jar) (8.4.5 postgres, driver
version 8.4-702) return always - 1
Code iBatis xml
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 *
I need something to put in the code ?
Thank you very much for responding.
From | Date | Subject | |
---|---|---|---|
Next Message | Marcin Krawczyk | 2010-12-08 12:49:50 | conditional aggregates |
Previous Message | Peter Steinheuser | 2010-12-07 21:54:41 | Re: concatenate question |