title: JPA fetchType.Lazy is not working
body: <p>I am trying examples for <code>fetchType.Lazy</code>, however while debugging the code, it seems that <code>fetchType.Lazy</code> is not working.</p>
  
  <p>Entity bean: Address</p>
  
  <p>Added annotation @Basic with property fetch=fetchType.Lazy on district field.</p>
  
  <p>My entity bean is defined by the code below:</p>
  
  <pre><code>    package model;
  
      import java.io.Serializable;
      import javax.persistence.*;
      import java.util.List;
  
  
      /**
       * The persistent class for the address database table.
       */
      @Entity
      @Table(name="address", schema="home")
      public class Address implements Serializable {
          private static final long serialVersionUID = 1L;
  
          @TableGenerator(name = "addr_gen", table = "table_generator", pkColumnName = "gen_name", valueColumnName = "gen_val", allocationSize=1)
          @Id
          @GeneratedValue(strategy=GenerationType.TABLE, generator="addr_gen")
          private String addressId;
  
          private String city;
  
          @Basic(fetch=FetchType.LAZY)
          @Column(name="district")
          private String district;
  
          private String houseNumber;
  
          private String pincode;
  
          private String state;
  
          private String street;
  
          //bi-directional many-to-one association to Employee
          @OneToMany(mappedBy="address")
          private List&lt;Employee&gt; employees;
  
          public Address() {
          }
  
  
          public String getAddressId() {
              return this.addressId;
          }
  
          public void setAddressId(String addressId) {
              this.addressId = addressId;
          }
  
          public String getCity() {
              return this.city;
          }
  
          public void setCity(String city) {
              this.city = city;
          }
  
          public String getDistrict() {
              return this.district;
          }
  
          public void setDistrict(String district) {
              this.district = district;
          }
  
          public String getHouseNumber() {
              return this.houseNumber;
          }
  
          public void setHouseNumber(String houseNumber) {
              this.houseNumber = houseNumber;
          }
  
          public String getPincode() {
              return this.pincode;
          }
  
          public void setPincode(String pincode) {
              this.pincode = pincode;
          }
  
          public String getState() {
              return this.state;
          }
  
          public void setState(String state) {
              this.state = state;
          }
  
          public String getStreet() {
              return this.street;
          }
  
          public void setStreet(String street) {
              this.street = street;
          }
  
          public List&lt;Employee&gt; getEmployees() {
              return this.employees;
          }
  
          public void setEmployees(List&lt;Employee&gt; employees) {
              this.employees = employees;
          }
  
  
          public Employee addEmployees(Employee employees) {
              getEmployees().add(employees);
              employees.setAddress(this);
  
              return employees;
          }
  
          public Employee removeEmployees(Employee employees) {
              getEmployees().remove(employees);
              employees.setAddress(null);
  
              return employees;
          }
  
          /*@Override
          public String toString() {
              return "Address [addressId=" + addressId + ", city=" + city
                      + ", district=" + district + ", houseNumber=" + houseNumber
                      + ", pincode=" + pincode + ", state=" + state + ", street="
                      + street + ", employees=" + employees + "]";
          }*/
      }
  </code></pre>
  
  <p>The method which uses above entity bean:</p>
  
  <pre><code>public Address findAddress(EntityManagerFactory emf, UserTransaction tx) {
      EntityManager em = emf.createEntityManager();
      Address addr = null;
      try {
          tx.begin();
          addr = em.find(Address.class, new String("154"));
          tx.commit();
      } catch (Exception e) {
          e.printStackTrace();
      }
  
      return addr;
  }
  </code></pre>
  
  <p>So after the <code>find</code> method call, when I inspected the address object, it was already populated with district field.</p>
  
  <p>Please let me know whether I am missing some configuration or whether there is some issue with the code itself.</p>