I think the Session should always be flushed prior to an SQL query, if the user hasn't added a synchronized table (or entity) to mark what this tables this query is inspecting.