Reputation: 1
I´m looking to do this with executeUpdate, the thing is concat a string value with executeUpdate in GRAILS
def transactions = Transaction.findAll()
for (tr in transactions) {
tr.comment = tr.comment + " new words...."
tr.save()
}
Upvotes: 0
Views: 402
Reputation: 12271
def transactions = Transaction.all //you can use findAll() also
for (Transaction tr : transactions) {
tr.comment = tr.comment + " new words...."
tr.save(flush:true)
}
Hope it will help you
Upvotes: 0
Reputation: 961
I have not tried but something like this
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...'])
Upvotes: 1