-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancementA general enhancement
Milestone
Description
Adrian opened SPR-7564 and commented
On the forum there is thread that this problem cannot be solved (http://forum.springsource.org/showthread.php?t=19293).
The latest JDBC drives for postgres seam to work fine when returning the generated keys from a prepared statement but Spring Framework still seams to have issues getting this key. When calling getKey on a GeneratedKeyHolder object NULL is returned, whereas the following plain jdbc code works fine:
PreparedStatement preparedStatement = connection.prepareStatement(SQL,
PreparedStatement.RETURN_GENERATED_KEYS);
preparedStatement.setString(1, entityType.getMetaData());
preparedStatement.executeUpdate();
Long entityPrimaryKey = null;
ResultSet generatedKeys = preparedStatement.getGeneratedKeys();
if (generatedKeys.next())
entityPrimaryKey = Long.valueOf(generatedKeys.getLong(1));
preparedStatement.close();
My table definition on postgres is as follows:
CREATE TABLE "entity_type" (
"entity_type_id" SERIAL ,
"meta_data" TEXT NOT NULL ,
PRIMARY KEY ("entity_type_id") );
Affects: 3.0.4
Reference URL: http://forum.springsource.org/showthread.php?t=19293
Attachments:
- postgres-test.zip (5.42 kB)
- postgres-test-exception.txt (2.69 kB)
Referenced from: commits 97e047e
Metadata
Metadata
Assignees
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancementA general enhancement