Alessandro
unread,Feb 28, 2012, 11:00:03 PM2/28/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Morphia
Hi,
I was looking through the code and was wondering how the @Reference
annotation is implemented.
I looked at the ReferenceMapper and from what I can see, it will
execute a query for each object in the returned collection and fetch
the references for each document. If the reference is a collection, it
will loop through those and query for each value.
Is this right?
So, for example, just to confirm:
class SingleRef {
@Reference InnDoc doc;
...
//Setter/getters
}
When fetching and using the SingleRef, if I have 10 SingleRef
documents, that means that 10 extra queries will be fired to Morphia
to fetch the InnDoc? or are these 10 queries joined into a single in()
query?
Also, for the scenario:
class SingleRef {
@Reference List<InnDoc> doc;
...
//Setter/getters
}
If I had 10 SingleRef and each had 10 InnDoc in the list, would that
be 100 individual queries? Or, like above, are they joined into one
query?
Any help would be great! :)
Thanks,
Ale