Hello!
I've run across a strange GORM issue that manifests itself while running the application, but does NOT happen when running the same code in a grails shell. I have a typical one-to-one relationship similar to below with eager fetching by the parent object on a one-to-one child:
class Parent {
Child child
static mapping = {
child fetch:'join'
}
}
class Child {
static belongsTo = [parentalUnit:Parent]
}
According to the hibernate sql logging, whenever I retrieve a Parent by id I'm also retrieving the same Parent by child_id, caused by the Child object retrieving the Parent. This overhead is especially bothersome when retrieving a list of Parents. The weird thing is that when I start up a grails shell and retrieve a Parent, I don't see any subsequent retrievals made on the Child's behalf.
Can someone explain what's going on? I want to suppress the Child from retrieving it's Parent if I'm getting a Parent.
Thanks,
Jaime


Reply With Quote