I didn't had more meaningful way to highlight issue in subject but here is the explanation.
Suppose I have following domain object
Class Face{
static mapping = {
cache true
}
Nose nose
}
Class Nose{
static mapping = {
cache true
}
String type
String externalId
}
Now, when I query on Face as follows
Face face = Face.find("from Face f where f.nose.externalId = :externalId", [externalId:"878781"])
Here suppose the all relevant record do exist in DB. So for the first time it return me the correct domain object but on subsequent query return me the null object. I totally get stumped with this behaviour.
This query is in service.
Please help me to find out what is wrong from my end.
Thanks a lot.