I have a Grails application using GORM to save a Note domain object.
I can successfully save the Note object but when I query the collection containing the object using afterInsert it doesn't find the object. When I query the collection manually I can see the object has been created. Is there any reason why this is occurring? I can't see why.
Note
def afterInsert(){
println(id) //prints the id as expected. Matches the database
def persisted = getDB().notes.findOne(id)
println(persisted)
//returns null
}
NoteService
noteInstance.save(flush: true, failOnError: true))