Skip to content

Create vendor specific database dialect to handle ID creation specifics of MS-SQL Server [DATAJDBC-278] #503

@spring-projects-issues

Description

@spring-projects-issues

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:

  • DATAJDBC-309 Add infrastructure for semantic SQL generation

1 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions