When the Configuration#useGeneratedKeys set to true and omit the useGeneratedKeys attribute at <update>, a JDBC standard generated keys feature does not work.
i think useGeneratedKeys property depend on dbms auto generated key , if a sql statement can't generate auto increment primary key ,the feature would not be work.
When the
Configuration#useGeneratedKeys
set totrue
and omit theuseGeneratedKeys
attribute at<update>
, a JDBC standard generated keys feature does not work.Probably, following code is the root cause.
https://github.com/mybatis/mybatis-3/blob/adbcd98d17b993af6d19997aa81da82ae507669e/src/main/java/org/apache/ibatis/builder/xml/XMLStatementBuilder.java#L104-L106
Is this behavior specification or not?
MyBatis version
3.4.6
Database vendor and version
Any
Notes
The
<insert>
works fine in the same condition.