Thomas Lang opened DATAJDBC-278 and commented
When trying to insert values in a mssql server table the setting of IDs (defined as identity and primary key) with explicit values is not supported.
Here is the exception:
Caused by: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO manual (content, lego_set, id) VALUES (?, ?, ?)]; Cannot insert explicit value for identity column in table 'MANUAL' when IDENTITY_INSERT is set to OFF.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert explicit value for identity column in table 'MANUAL' when IDENTITY_INSERT is set to OFF.
The suggestion is to build a vendor specific database dialect which excludes the id generation on mssql server.
Scripts and tests can be found here:
https://github.com/THD-Thomas-Lang/spring-data-jdbc
Affects: 1.0.1 (Lovelace SR1)
Reference URL: https://stackoverflow.com/questions/3112579/identity-insert-is-set-to-off-how-to-turn-it-on
Issue Links:
1 votes, 4 watchers