Grails Bulk updates

Meni Lubetkin
Meni Lubetkin
Published in
1 min readFeb 27, 2015

if you have a bulk operation: delete or update you can set the flush so it will occur every 1000 records updated.

def commitEvery = 1000
Domain.list().eachWithIndex{ obj, index ->
obj.property = new value
obj.save flush:0 == index % commitEvery
}
session = sessionFactory.getCurrentSession()
session.clear()

--

--