DATAJDBC-262 - Update statements no longer set the id column.
This commit is contained in:
committed by
Greg Turnquist
parent
0816f4182e
commit
3d67ad08ed
@@ -284,8 +284,9 @@ class SqlGenerator {
|
||||
|
||||
String updateTemplate = "UPDATE %s SET %s WHERE %s = :%s";
|
||||
|
||||
String setClause = columnNames.stream()//
|
||||
.map(n -> String.format("%s = :%s", n, n))//
|
||||
String setClause = columnNames.stream() //
|
||||
.filter(s -> !s.equals(entity.getIdColumn())) //
|
||||
.map(n -> String.format("%s = :%s", n, n)) //
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
return String.format(updateTemplate, entity.getTableName(), setClause, entity.getIdColumn(), entity.getIdColumn());
|
||||
|
||||
Reference in New Issue
Block a user