MyBatis:Postgres 下如何返回插入对象的ID? [英] MyBatis: How to return the ID of the inserted object under Postgres?

查看:28
本文介绍了MyBatis:Postgres 下如何返回插入对象的ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 postgres 表,其中 ID 定义为 bigserial.如何我可以使用 @Insert 并取回插入实体的 id 吗?我是期望映射器方法返回 id 或填充 id实体对象内的字段.有什么想法吗?

解决方案

NVM,我想我在另一个线程上找到了答案,http://mybatis-user.963551.n3.nabble.com/How-to-return-the-ID-of-the-inserted-object-under-Postgres-td1926959.html

这里有其他人的链接.

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, 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆