== Why is this an issue?

Hibernate's lazy loading allows you to retrieve just the data of the current class without being forced to load all its related classes. For instance with lazy loading, you can pull up an instance of a ``++Lecture++`` ``++@Entity++`` without being forced to load all its ``++Student++``s. 


But that's only if you're storing the ``++Student++``s in a collection. Store them in an array instead, and the benefits of lazy loading are no longer available.


This rule raises an issue on each array in ``++@Entity++`` classes.


=== Noncompliant code example

[source,java]
----
@Entity
public class Lecture {

  @OneToMany
  private Student [] attendees;  // Noncompliant
  // ...
}
----


=== Compliant solution

[source,java]
----
@Entity
public class Lecture {

  @OneToMany
  private List<Student> attendees;
  // ...
}
----


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

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

include::message.adoc[]

include::highlighting.adoc[]

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