26 lines
854 B
Plaintext
26 lines
854 B
Plaintext
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
|
|
|
|
[source,java]
|
|
----
|
|
Session session = sessionFactory.openSession();
|
|
session.setFlushMode(FlushMode.NEVER); // Noncompliant
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|