Details
Description
Given a domain class that has an ID with UUID generation turned on:
class MyDomain {
String id
String desc
static mapping = {
id generator: 'uuid'
}
}
When I attempt to mock multiple instances of the domain class:
new MyDomain(desc: "One").save(flush: true) new MyDomain(desc: "Two").save(flush: true) new MyDomain(desc: "Three").save(flush: true) new MyDomain(desc: "Four").save(flush: true)
Then when I attempt see the count of domain objects in test I see:
assert MyDomain.count() == 4
with result: 1 and failed assertion.
Then I check on each domain object to see what is it's ID and all of them have an ID of 1 after creation. It seems that the domain objects that are created do not have an appropriate generated ID and instead try to update the first domain object created. When I look at the 'desc' attribute after saving all 4 of them:
assert MyDomain.findAll().get(0).desc == "One"
The result is that the 'desc' attribute actually equals "Four", the last value to be saved.
The expected behavior is that I save 4 instances of MyDomain and that each has its own ID value even when UUID generation is turned on in the MyDomain mapping.
Is there an ETA on version 2.0.1 release. Of course, I saw that 2.0 GA just got out today so I am sure it will be a bit. Is there a workaround that I can use in the meantime?