grails-data-mapping icon indicating copy to clipboard operation
grails-data-mapping copied to clipboard

RemoveAll does not remove

Open tmanthey opened this issue 6 years ago • 0 comments

Steps to Reproduce

  1. define following domain class

class Mytest { def my_data = "123" static hasMany = [childItems: Mytest] }

  1. 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

tmanthey avatar Feb 19 '19 18:02 tmanthey