title: confused about Lazy loading
body: <p>While trying to do some tests on lazy loading, to check if i'm understanding it well, i got totally confused.</p>
  
  <p>Here's the entities i'm using on my test:</p>
  
  <pre><code>@Entity
  public class Family {
  @Id
  private int id;
  
  
  @OneToMany(mappedBy="family", fetch=FetchType.LAZY)
  private Set&lt;Person&gt; members;
  
  //getters &amp; setters
  
  public String toString(){
      String s="";
      for(Person p:getMembers()){
          s+=p.getFirstName();
      }
      return s;
  }
  }
  
  @Entity
  public class Person implements Comparable&lt;Person&gt;{
  @Id
  private int id;
  
  private String firstName;
  private String lastName;
  
  @ManyToOne
  private Family family;
  
  //getters &amp;setters
  }
  </code></pre>
  
  <p>here's my main method:</p>
  
  <pre><code>public static void main(String[] args) {
      factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
      em = factory.createEntityManager();
  
      Query q = em.createQuery("select f from Family f");
      List&lt;Family&gt; families= q.getResultList();
  
      em.clear();
      em.close();
      factory.close();
  
      for(Family f:families){
          System.out.println(f);
      }
  }
  </code></pre>
  
  <p>
  What i understood from lazy loading, is that if an attribute is marked to be fetched lazily, and doesn't get accessed while it's managed, it won't be loaded in memory and any attempt to access it later won't work. Now what confuses me is that the test described above doesn't have any problem when accessing the lazy members attribute through the detached Family list, even after closing the EM and the EMF ! ... Is that normal? Am-i miss-understanding the lazy loading concept?
  </p>
  
  <p><b>Note :</b> I'm using a J2SE environment with an embedded DB. My provider is EclipseLink</p>
  
  <p>Thanks in Advance<br/>
  George</p>