MyBatis: How to return the ID of the inserted object under Postgres?

Gili picture Gili · Nov 23, 2010 · Viewed 9.5k times · Source

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?

Answer

user519298 picture user519298 · Nov 24, 2010

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.