mybatis-spring-boot-starter oracle get id

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

mybatis-spring-boot-starter oracle get id

davaasurenx
used xml mapper. Oracle db.
not return value of column "id". return value is 1.
<insert id="insert" parameterType="User" keyColumn="id" keyProperty="id" parameterMap="parameters" useGeneratedKeys="true">
when use useGeneratedKeys="true", insert is not working.
how get id or value of last inserted data?

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mybatis-spring-boot-starter oracle get id

Guy Rouillier-2
  <insert id="insertStatement" parameterType="User">
    <selectKey keyProperty="id" resultType="int" order="BEFORE">
        select SEQUENCE_NAME.nextval from dual
      </selectKey>
    INSERT INTO myTable ...

I don't remember if we tried useGeneratedKeys and that didn't work, but this is what we use in our Oracle appilcations.

--
Guy Rouillier

------ Original Message ------
To: "mybatis-user" <[hidden email]>
Sent: 9/11/2017 10:49:23 PM
Subject: mybatis-spring-boot-starter oracle get id

used xml mapper. Oracle db.
not return value of column "id". return value is 1.
<insert id="insert" parameterType="User" keyColumn="id" keyProperty="id" parameterMap="parameters" useGeneratedKeys="true">
when use useGeneratedKeys="true", insert is not working.
how get id or value of last inserted data?

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: mybatis-spring-boot-starter oracle get id

Kazuki Shimizu
Could you provide small reproduce project via GitHub repository? or full DDL(create table) and full Mapper file?
IN my memory is correct, the ID column was supported from Oracle 12c. Which version is used?

Thanks.

On Tuesday, September 12, 2017 at 2:22:47 PM UTC+9, Guy Rouillier wrote:
  <insert id="insertStatement" parameterType="User">
    <selectKey keyProperty="id" resultType="int" order="BEFORE">
        select SEQUENCE_NAME.nextval from dual
      </selectKey>
    INSERT INTO myTable ...

I don't remember if we tried useGeneratedKeys and that didn't work, but this is what we use in our Oracle appilcations.

--
Guy Rouillier

------ Original Message ------
From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="cqCV48IMAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">davaa...@...
To: "mybatis-user" <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="cqCV48IMAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybati...@...>
Sent: 9/11/2017 10:49:23 PM
Subject: mybatis-spring-boot-starter oracle get id

used xml mapper. Oracle db.
not return value of column "id". return value is 1.
<insert id="insert" parameterType="User" keyColumn="id" keyProperty="id" parameterMap="parameters" useGeneratedKeys="true">
when use useGeneratedKeys="true", insert is not working.
how get id or value of last inserted data?

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="cqCV48IMAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.