From c1b3fce8bf012798a39b733cfab49e32aa89829a Mon Sep 17 00:00:00 2001 From: Chriss Kalogeropoulos Date: Mon, 27 Sep 2021 12:59:30 +0300 Subject: [PATCH] Exclude fixed concurrency mode fields for model create because Sequelize now uses bind parameters and the insert fails The error on SQL Server is "Cannot insert an explicit value into a timestamp column" --- breeze-sequelize/src/SequelizeSaveHandler.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/breeze-sequelize/src/SequelizeSaveHandler.ts b/breeze-sequelize/src/SequelizeSaveHandler.ts index 5ca4f55..73ab0f1 100644 --- a/breeze-sequelize/src/SequelizeSaveHandler.ts +++ b/breeze-sequelize/src/SequelizeSaveHandler.ts @@ -322,8 +322,11 @@ export class SequelizeSaveHandler { keyMapping = { entityTypeName: entityTypeName, tempValue: tempKeyValue, realValue: realKeyValue }; } } + const fields = entityType.dataProperties + .filter(x => !(x.concurrencyMode === "Fixed" && x.dataType.name === "Binary")) + .map(x => x.nameOnServer); try { - const savedEntity = await sqModel.create(entity, { transaction: transaction }); + const savedEntity = await sqModel.create(entity, { fields: fields, transaction: transaction }); if (keyMapping) { if (keyMapping.realValue === null) { keyMapping.realValue = savedEntity[firstKeyPropName];