Something is not getting flushed. A simplified example of what's happening:
def testDemo() {
def person = new Person(...)
person.save(flush: true)
println "Number of people after save: " + Person.all.size()
def dummyList = [1, 2, 3, 4, 5]
GParsPool.withPool { num ->
println "Number of people after withPool: " + Person.all.size()
dummyList.eachParallel {
println "Number of people after eachParallel " + Person.all.size()
Person.withTransaction {
...
This outputs:
Number of people after save: 1
Number of people after withPool: 1
Number of people after eachParallel: 0
I don't understand if I have to do something with Session and Transaction to make the data persist or if this is a bug in GPars. What is going on here at the underlying hibernate level?
I want the recently created Person to be visible within the parallel closure.