== Why is this an issue?

Persistence annotations should be marked either on fields or on getters but not on both. Mix the two and the annotated fields will be ignored. The potential results are that your database tables are not created or not populated (and read) correctly.


=== Noncompliant code example

[source,java]
----
@Entity
public class Person {  // Noncompliant; both fields and getters annotated
  @Id
  private Long id;
  private String fname;

  public Long getId() { ... }

  @Column(name="name")
  public String getFname() { ... }
----


=== Compliant solution

[source,java]
----
@Entity
public class Person {
  @Id
  private Long id;
  @Column(name="name")
  private String fname;

  public Long getId() { ... }

  public String getFname() { ... }
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

This class has n fields and m getters annotated for persistence.


endif::env-github,rspecator-view[]
