This leaves me wondering. Does this mean I can have two objects that map to the same database record, one in the individual object cache and one in the query result cache?No. The DataObject uniquing is guaranteed per ObjectContext by Cayenne regardless of the caching.
I have a few more questions if you don't mind. These aren't as important as the above one, I'm just checking how inaccurate my mental model of Cayenne is. So even a response of "you're asking the wrong questions" might be helpful.
Do both caches contain just persistent objects?
Things I can imagine for the query cache:
- Scalar results, such as the result from a SELECT COUNT(*)
- Prepared queries (I guess it's actually associated with the ObjectContext)
- Result sets, scrollable ones in particular (probably in ObjectContext, too)
If both caches contain persistent objects: from the answer above I conclude that the same object can be in both caches.
If an object is culled from one of the caches, is it removed from the other as well, or is it kept?