Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
3.0.2-rc
-
None
Description
org.mariadb.jdbc.Connection.prepareStatement(String sql, int columnIndexes[]) and prepareStatement(String sql, String columnNames[]) call prepareStatement(sql), which in turn calls prepareInternal() with Statement.NO_GENERATED_KEYS, while it should request auto-generated keys using Statement.RETURN_GENERATED_KEYS.
Excerpt from JDBC Connection javadoc for these methods: "Creates a default PreparedStatement object capable of returning the auto-generated keys".
This leads to INSERTs to fail with SQLException: "Cannot return generated keys: query was not set with Statement.RETURN_GENERATED_KEYS".
In particular, this makes Spring JDBC SimpleJdbcInsert unusable as under the cover prepareStatement(String sql, String columnNames[]) gets called.