Ensure Hibernate does not try to autoflush during the intermediate query, which can cause a detached object exception