[CONJ-234] ava.sql.SQLException: getGeneratedKeys error. Statement.RETURN_GENERATED_KEYS must be precised on connection.prepareStatement(String sql, int autoGeneratedKeys) or statement.executeUpdate(String sql, int autoGeneratedKeys) Created: 2015-12-10 Updated: 2015-12-31 Resolved: 2015-12-31 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.3.0, 1.3.2, 1.3.1, 1.3.3 |
| Fix Version/s: | 1.3.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Frank S | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Consider following testcase:
This runs fine on all versions befor 1.3.0. At version 1.3.0 following exception is thrown:
The only way to fix ist to run the prepareStatement with the argument RETURN_GENERATED_KEYS (just as the commented line). |
| Comments |
| Comment by Diego Dupin [ 2015-12-15 ] |
|
Current implementation follow JDBC rules and permit to use less memory (avoid to parse and load in memory those informations). For transition, an option must have been added to facilitate transition, but, as every option add complexity and above all take process time for each query, this option will be marked as deprecated so to avoid it used, and will have a end of life in a few years. |
| Comment by Diego Dupin [ 2015-12-31 ] |
|
Documentation option was missing : alwaysAutoGeneratedKeys JDBC permit to retrieve previous insert id's by the Statement.getGeneratedKeys() command. When option alwaysAutoGeneratedKeys is set to true, insert id's will be retrieved even if no autoGeneratedKeys parameter or Statement.NO_GENERATED_KEYS is set. |