
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
60 lines
1.1 KiB
Plaintext
60 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
The Java Persistence API specification imposes only a conditional requirement that ``++@Entity++`` classes be ``++Serializable++``:
|
|
|
|
____
|
|
If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the entity class must implement the ``++Serializable++`` interface.
|
|
____
|
|
|
|
|
|
But it's best practice to make all such classes ``++Serializable++`` from the start. So this rule raises an issue when an ``++@Entity++`` does not implement ``++Serializable++``.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
@Entity
|
|
pubic class Person { // Noncompliant
|
|
private String fname;
|
|
// ...
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
@Entity
|
|
pubic class Person implements Serializable {
|
|
private String fname;
|
|
// ...
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Make this class "Serialiazable".
|
|
|
|
|
|
=== Highlighting
|
|
|
|
class name
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 1 Dec 2015, 11:14:17 Michael Gumowski wrote:
|
|
LGTM!
|
|
|
|
endif::env-github,rspecator-view[]
|