Skip to content

SQL-Exception on save with sql server dialect #24

@sengmann

Description

@sengmann

When we are using sql server dialect and use the save or update method there will be this exception. In #18 you suggest to use Column#setIgnoreOnUpdate(true). But we need to set this on every table we use. Better when LSql sets automatically on primary key columns ignoreOnUpdate=true

Caused by: java.sql.SQLException: Cannot update identity column 'id'.
	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) ~[jtds-1.3.0.jar:1.3.0]
	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2893) ~[jtds-1.3.0.jar:1.3.0]
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2335) ~[jtds-1.3.0.jar:1.3.0]
	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:638) ~[jtds-1.3.0.jar:1.3.0]
	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613) ~[jtds-1.3.0.jar:1.3.0]
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572) ~[jtds-1.3.0.jar:1.3.0]
	at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:727) ~[jtds-1.3.0.jar:1.3.0]
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-2.5.1.jar:na]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-2.5.1.jar:na]
	at com.w11k.lsql.Table.executeUpdate(Table.java:487) ~[lsql-core-0.23.0.jar:na]
	at com.w11k.lsql.Table.updateWhere(Table.java:229) ~[lsql-core-0.23.0.jar:na]
	... 44 common frames omitted

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions