|
If we want to have specific options for multi-load, we may want a separate API for this rather than reusing IdentifierLoadAccess. Ultimately that is my concern.
IdentifierLoadAccess grew out of the desire to get out of the proliferation of Session#get and Session#load overloaded forms. That said, I guess CacheMode could make sense even just for single-id get/load calls. So I guess I am fine adding this all to IdentifierLoadAccess. I can see something like:
public interface IdentifierLoadAccess<T> {
IdentifierLoadAccess<T> with(CacheMode cacheMode);
...
<K extends Serializable> List<T> multiLoad(K... ids);
<K extends Serializable> List<T> multiLoad(List<K> ids);
}
A trivial impl for now would be to have the IdentifierLoadAccessImpl set/reset the CacheMode before/after the get/load/multiLoad calls.
|