rspec/rules/S3362/java/rule.adoc

26 lines
854 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
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.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
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[]