Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Hello MariaDB,
Seems like I found a bug in your current MariaDB JDBC connector (Version 1.5.7).
When using the following Java code to bulk insert data in our MariaDB via JDBC/Spring-JDBC the attached "org.springframework.jdbc.support.GeneratedKeyHolder.GeneratedKeyHolder" returns only 1 generated key, even though there have been generated more than 1 within the DB, which can be verified in the DB.
The MySQL JDBC connector (Version 5.1.40) is working fine and returns the correct number of generated keys.
If you need some more data on this error, please contact me.
with kind regards
Anndreas Soderer
AGNITAS AG
JAVA-Code:
JdbcTemplate jdbcTemplate = new JdbcTemplate(getDataSource());
|
|
KeyHolder keyHolder = new GeneratedKeyHolder();
|
final String query = queryStringBuilder.toString();
|
jdbcTemplate.update(
|
new PreparedStatementCreator() {
|
@Override
|
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
PreparedStatement ps =
|
connection.prepareStatement(query, new String[] {"customer_id"});
|
return ps;
|
}
|
},
|
keyHolder);
|
|
List<?> keys = keyHolder.getKeyList();
|
for (Object key : keys) {
|
@SuppressWarnings("unchecked")
|
Map<Object, Object> keyMap = (Map<Object, Object>)key;
|
Entry<Object, Object> entry = keyMap.entrySet().iterator().next();
|
Long id = (Long) entry.getValue();
|
results.add(id.intValue());
|
}
|