Efficiently load multiple ad hoc NHibernate entities with cache support

36 views
Skip to first unread message

Nathan Baulch

unread,
Jan 30, 2012, 10:10:30 PM1/30/12
to nhu...@googlegroups.com
I need to efficiently load a large number of entities based on a list of ad hoc IDs. Unfortunately it doesn't look like the 2nd level cache is checked first when making "Restrictions.In(Projections.Id(), ids)" criteria queries.

I guess I'm looking for something similar to "ISession.Load" that takes a collection of IDs (instead of just one) and only execute an IN query for entities that can't be found in either the 1st or 2nd level caches. If nothing like this exists then what's the easiest way to check the two caches manually without resorting to reflection?
Reply all
Reply to author
Forward
0 new messages