我希望用executeUpdate执行此操作,事情是使用GRAILS中的executeUpdate连接一个字符串值
def transactions = Transaction.findAll()
for (tr in transactions) {
tr.comment = tr.comment + " new words...."
tr.save()
}
答案 0 :(得分:1)
我没有尝试过这样的事情
Transaction.executeUpdate("update Transaction t set t.comment=t.comment + :newComment", [newComment: 'new words...'])
OR
Transaction.executeUpdate("update Transaction t set t.comment=concat(t.comment, :newComment), [newComment: 'new words...'])
答案 1 :(得分:0)
{{1}}
希望它能帮到你