1

我正在使用 JPAUpdateClause 更新满足 BooleanExpression where 子句的所有行。

BooleanExpression where = myEntity.id.isNotNull();
long updatedCount = update.where(where)
        .set(myEntity.comments, request.getComment())
        .execute();

myEntity.comments 是一个字符串。

调用 set() 时是否可以附加 request.getComment() 而不是替换现有值?

4

1 回答 1

1

而不是 put request.getComment(),尝试类似下面的东西

Expressions.operation(String.class, Ops.ADD, myEntity.comments, request.getComment())
于 2018-08-14T17:22:04.480 回答