By executing the follwoing function:
public void deleteByEntryId(long id)
{
super.getSession().createSQLQuery("DELETE FROM guest WHERE entry_fk = " + id).executeUpdate();
}
will the cache of Hibernate be aware / notified of the deletion of the Guest objects?
- The super class is Spring’s Hibernate Template which offers the method
getSession()and many others - createSQLQuery(…)` is a function of Hibernate.
(I am asking as depeding on whether I am deleting by object or by SQLquery I get a StaleState or a OtimistickLockException further on in my test.)
No, it won’t. Even HQL update and delete queries don’t affect in-memory state.