By default, Hibernate ``++session++`` flushing is set to ``++FlushMode.AUTO++``, and is called from ``++Transaction.commit++``, ``++Session.flush++`` and before some queries are executed. Setting it to ``++FlushMode.COMMIT++``, ``++FlushMode.NEVER++``, or ``++FlushMode.MANUAL++`` could mean that parts of your application get stale data, so you should be sure of what you're doing before you use any of these modes.


This rule raises an issue when flush mode is explicitly set to any of these modes.


== Noncompliant Code Example

----
Session session = sessionFactory.openSession();
session.setFlushMode(FlushMode.NEVER);  // Noncompliant
----

