Hi,
I deleted a bunch of stuff from my database through direct sql and restarted tomcat.
Now, I'm seeing
Code:
Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [nl.project.model.Category#28]
at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:435)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:233)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
Row 28 doesn't exist anymore so if this row was requested it would make sens that the error is thrown.
However, I'm retrieving the row through
Code:
DetachedCriteria dc = DetachedCriteria.forClass(Category.class);
dc.add(Restrictions.eq("country", country));
getHibernateTemplate().setCacheQueries(true);
getHibernateTemplate().setQueryCacheRegion(CacheRegion.LONGQUERY);
return getHibernateTemplate().findByCriteria(dc);
The country field is modeled as a foreign key for Category. So there's no many-to-many table or stuff like that.
Is it possible that the query cache persists through a vm restart? If so, how do I flush it?
Kind regards,
Marc