Timur Atakishiev
01/10/2020, 7:55 AMtapac
01/10/2020, 8:42 AMval batchUpdate = BatchUpdateStatement(FooTable)
dataToUpdate.forEach { entry ->
batchUpdate.addBatch(entry.id)
batchUpdate[FooTable.bar] = entry.bar
}
batchUpdate.execute(TransactionManager.current())
Timur Atakishiev
01/10/2020, 8:52 AMMourad
02/26/2020, 3:32 PMBatchUpdateStatement
extends from UpdateStatement
but does not allow to override the where section... Perhaps this is done because the id of that element is been put there (obviously) to know which element to update. Is there a way to extend this where-clause with more conditions?tapac
02/26/2020, 3:33 PMbatch update with where condition
means?Mourad
02/26/2020, 3:41 PMUPDATE Items SET columnName='value' WHERE id = '2e9a4830-33b3-44f9-99af-98b7b5472c22'
The BatchUpdateStatement
does not allow to override the where-clause but generates the where-clause by using:
${transaction.identity(table.id)} = ?
Is there a way to extend the where-clause to something like:
WHERE id = '2e9a4830-33b3-44f9-99af-98b7b5472c22' AND organizationId = 1
Mourad
02/26/2020, 3:45 PMtapac
02/26/2020, 4:39 PMvalue
for every id ?Mourad
02/26/2020, 4:42 PMtapac
02/26/2020, 4:44 PMItems.update({
(id eq '123' and orgId eq '1212') or
(id eq '1234' and orgId eq '12152')
}) {
it[value] = '123'
}
I'm not sure what will be fasterMourad
02/26/2020, 4:51 PM