Just a silly question:
Does it make sense to uniquely identify a named query cache region according to parameters so that individual result set can be cleared individually? This might not make sense but let me give an example:
Code:
public List getStuff (Long someId) {
return getSession().getNamedQuery("someQuery")
.setParameter(0, someId)
.setCacheable(true)
.setCacheRegion("someRegion:" + someId.toString())
.list();
}
-- or --
Code:
public List getStuff (Long someId) {
return getSession().getNamedQuery("someQuery")
.setParameter(0, someId)
.setCacheable(true)
.setCacheRegion("someRegion")
.list();
}
the, if I delete the object that relates to
someIdCode:
public void delete (Long someId) {
getSession.delete(getSession().load(SomeObj.class, someId));
getSessionFactory().evictQueries("someRegion:" + someId.toString());
}
-- or --
Code:
public void delete (Long someId) {
getSession.delete(getSession().load(SomeObj.class, someId));
getSessionFactory().evictQueries("someRegion");
}
So, is having unique cache regions according to query parameters just un-necessary? Thanks very much