what you see is by design. criteria is designed to pull back a set of
results (even if the set is a single instance) while Get and Load are
designed to pull back a single instance of an entity. Get and Load
take advantage of the 1st level cache because the id of the entity is
known, criteria does not have the identity so it cannot look up the
entity against the 1st level cache.
CacheMode is part of 2nd level cache. that is a whole different system
than 1st level cache. it requires a fair amount of configuration, both
on the session factory, the criteria, and the caching implementation.
if not configured properly you can actually hurt preformance rather
than enhance it. I'll spare the details of who 2nd level cache works,
sufficed to say it's not a feature you just implement without serious
thought to how you want to apply the cache.
personally i only use 2nd level cache as a very last resort. there are
other ways of boosting preformance without in-memory cache.
for more information on the topic read the NH docs on 2nd level cache.
> >
nhusers+u...@googlegroups.com<
nhusers%2Bunsu...@googlegroups.com>
> > .