== Why is this an issue?

Including any logic other than a simple return of the field in a persistence-annotated method can result in odd behavior, including for example, the default construction of empty members which are annotated to be ``++lazy++``.


=== Noncompliant code example

[source,java]
----
private Double price;

@Columm(name="price")
public Double getPrice() {
  if(buyer.isLoaltyMember()) {  // Noncompliant
    return price - getLoyaltyDiscount();
  } else {
    return price;
  }
}
----


=== Compliant solution

[source,java]
----
@Columm(name="price")
private Double price;

public Double getPrice() {
  if(buyer.isLoaltyMember()) {
    return price - getLoyaltyDiscount();
  } else {
    return price;
  }
}
----
or

[source,java]
----
private Double price;

@Columm(name="price")
public Double getPrice() {
  return price;
}

public Double calculatePrice() {
  if(buyer.isLoaltyMember()) {  // Noncompliant
    return getPrice() - getLoyaltyDiscount();
  } else {
    return getPrice();
  }
}
----


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

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

=== Message

Remove the additional logic from this method or switch all annotations to this class' fields.


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