emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

Unable to get auto-generated ID with mysql using annotations #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is a standard flow in any DAL - insert a new record, and get the new 
auto-generated / auto-incremented ID.
I haven't found how to do this with mybatis. 

I found this question on how to do it on Postgres, but it doesn't work for me 
on mysql. 
http://stackoverflow.com/questions/4260428/mybatis-how-to-return-the-id-of-the-i
nserted-object-under-postgres

I'm cross-posting this to Stack Overflow
http://stackoverflow.com/questions/4283159/howto-return-ids-on-inserts-with-myba
tis-in-mysql-with-annotations

Original issue reported on code.google.com by ron.gr...@gmail.com on 26 Nov 2010 at 7:21

GoogleCodeExporter commented 9 years ago
Fixed with new @SelectKey annotation

Original comment by jeffgbut...@gmail.com on 29 Dec 2010 at 11:43