MyBatis的:如何给Postgres下返回插入对象的ID? [英] MyBatis: How to return the ID of the inserted object under Postgres?
问题描述
我已经得到了其中ID定义为 BIGSERIAL
A Postgres的表。怎么样
我可以使用 @Insert
并取回插入实体的ID?我是
期待映射器的方法要么返回ID或填充ID
实体对象内场。任何想法?
I've got a postgres table where the ID is defined as bigserial
. How
can I use @Insert
and get back the id of the inserted entity? I am
expecting the mapper method to either return the id or populate the id
field inside the entity object. Any ideas?
推荐答案
NVM,我想我找到了答案其他线程上,
<一href=\"http://mybatis-user.963551.n3.nabble.com/How-to-return-the-ID-of-the-inserted-object-under-Postgres-td1926959.html\" rel=\"nofollow\">http://mybatis-user.963551.n3.nabble.com/How-to-return-the-ID-of-the-inserted-object-under-Postgres-td1926959.html
NVM, i think i found the answer on the other thread, http://mybatis-user.963551.n3.nabble.com/How-to-return-the-ID-of-the-inserted-object-under-Postgres-td1926959.html
有是谁在这里登陆的链接,其他任何人。
There's the link for anyone else who lands here.
这篇关于MyBatis的:如何给Postgres下返回插入对象的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!