rspec/rules/S3356/java/rule.adoc

39 lines
908 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
The ability to map a class to a database table has made database interaction in Java a lot easier. But map multiple classes to the same table and you'll end up with a classic case of the left hand not knowing what the right hand is doing. In the worse case scenario, it could lead to serious data corruption.
This rule raises an issue when multiple classes are mapped to the same table with Hibernate or JPA annotations.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
@Entity // implicitly mapped to "point" table
public class Point {
// ..
}
@Entity
@Table(name = "point") // Noncompliant
public class Spot {
// ...
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]