[Building Sakai] Hibernate Caching

Holladay, Bryan Andrew bahollad at indiana.edu
Tue Sep 22 08:58:04 PDT 2009


Is there a more precise way to ensure that an associated object property in hibernate cache is not out of sync with the db other than calling getHibernateTemplate().getSessionFactory().evictEntity(class, id)

I prefer not to evict the entire class when it is just one attribute in that class I am concerned with.  The original query is:

getHibernateTemplate().find("from Cell cell where cell.matrix.id=?", matrix.getId());

I've tried specifying the attribute in the query in hopes that hibernate would refresh it w/no luck (also tried many different variations of this as well):

getHibernateTemplate().find("select cell from Cell cell, WizardPage wPage where cell.matrix.id=? and cell.wizardPage.status = wPage.status", matrix.getId())'

And also tried using the HQL command " fetch all properties "

getHibernateTemplate().find("select cell from Cell cell, WizardPage wPage fetch all properties where cell.matrix.id=? and cell.wizardPage = wPage",  matrix.getId())

The only thing that seemed to work was evicting the entire class/id combination.  Any other ideas from the community that would be more specific to just one attribute?

Thanks,
Bryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090922/58ce414b/attachment.html 


More information about the sakai-dev mailing list