rspec/rules/S3823/java/rule.adoc
2022-02-04 16:28:24 +00:00

34 lines
772 B
Plaintext

The use of a "RESOURCE_LOCAL" ``++persistence-unit++`` makes you responsible for your own entity management, which involves a lot of extra boilerplate code to get right. Instead, set this to "JPA" in a JavaSE environment or omit it altogether in a JavaEE environment, where "JPA" is the default.
== Noncompliant Code Example
[source,java]
----
<persistence-unit transaction-type="RESOURCE_LOCAL"> <!-- Noncompliant -->
----
== Compliant Solution
[source,java]
----
<persistence-unit transaction-type="JTA">
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]