gpt4 book ai didi

java - JPAUpdateClause - 设置值时是否可以连接字符串值?

转载 作者:行者123 更新时间:2023-11-30 06:03:19 26 4
gpt4 key购买 nike

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

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

myEntity.comments 是一个字符串。

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

最佳答案

不要放置 request.getComment(),而是尝试如下所示的内容

Expressions.operation(String.class, Ops.ADD, myEntity.comments, request.getComment())

关于java - JPAUpdateClause - 设置值时是否可以连接字符串值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51846031/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com