emacarron / mybatis

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

Better way to return generated PK after insert #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
2.x or maybe 3.x

Please describe the problem.  Unit tests are best!
Currently, iBatis need <selectKey> to get the generated primary key. But JDBC 
can use
Statement.RETURN_GENERATED_KEYS and Statement.getGeneratedKeys() to get the 
generated primary key. Why iBatis do not support this way to get ID?

Original issue reported on code.google.com by yangli...@gmail.com on 20 Sep 2010 at 2:03

GoogleCodeExporter commented 9 years ago
Version 3 does support generated keys. There is a useGeneratedKeys setting in 
the configuration xml file and for insert statements in mappers.

I don't think there are any plans to add support for this to Version 2.

Original comment by hpresnall@gmail.com on 14 Oct 2010 at 11:37

GoogleCodeExporter commented 9 years ago
Correct MB3 has this feature but some DB's (Oracle...) still need the 
selectKey.  MB2.x is only supported via bug fixes.  New features will only be 
added to MB3.

Original comment by nathan.m...@gmail.com on 22 Oct 2010 at 9:50