grails-data-mapping
grails-data-mapping copied to clipboard
RemoveAll does not remove
Steps to Reproduce
- define following domain class
class Mytest { def my_data = "123" static hasMany = [childItems: Mytest] }
- execute the following code
def mytest = new Mytest(childItems: [new Mytest()]) mytest.save(failOnError: true, flush: true) assert mytest.childItems.size() == 1 mytest.childItems.removeAll() mytest.save(failOnError: true, flush: true) assert mytest.childItems.size() == 0
Expected Behaviour
assert mytest.childItems.size() == 0 to be true
Actual Behaviour
assert mytest.childItems.size() == 0 is false. There is still 1 element present after call to removeAll() If I use use clear() method instead of removeAll() it works as expected.
Environment Information
Operating System: Ubuntu 16.04 GORM Version: gormVersion=6.1.10.RELEASE Grails Version (if using Grails): 3.3.8 JDK Version: 1.8.0_201