title: JPA: Table Relationship Issue
body: <p>I've two tables: reservation and machine. So, I have two classes:</p>
  
  <p><strong>Reservation</strong></p>
  
  <pre><code>@javax.persistence.Entity
  @Table(name = "reservation")
  @NamedQueries({
  @NamedQuery(
          name = "getActiveReservationByStatus",
          query = "select reservation from Reservation reservation where reservation.status=:status")  
         })
  public class Reservation implements Serializable {
      @javax.persistence.Id
      @Column(name = "reservation_id")
      @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
      private int id;
      @Column(name = "reservation_status")
      private int status = 1;
      @Column(name = "user_id")
      private int userId;
  
      @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy="reservation")
      private List&lt;Machine&gt; machineResultList;   
      public Reservation() {
      }
  
      public List&lt;Machine&gt; getMachineResultList() {
            return machineResultList;
      }
      public void setMachineResultList(List&lt;Machine&gt; machineResultList) {
          this.machineResultList = machineResultList;
      }
  
      //getters, setters...
  }
  </code></pre>
  
  <p><strong>Machine</strong></p>
  
  <pre><code>@javax.persistence.Entity
  @Table(name = "testmachine")
  
  @NamedQueries({
  @NamedQuery(
          name = "getMachineByState",
          query = "select testmachine from TestMachine testmachine where testmachine.reservation.userId =:status") ,
  @NamedQuery(
          name = "getMachineNameByReservation",
          query = "select machine from TestMachine machine where machine.reservation.status =:status")
        })
  
  public class TestMachine implements Serializable {
      @javax.persistence.Id
      @Column(name = "machine_id")
      @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
      private int id;
  
      @ManyToOne(cascade= {CascadeType.REFRESH}, fetch=FetchType.LAZY)
      @JoinColumn(name="reservation_id")
      private Reservation reservation;
  
      @Column(name = "machine_state")
      private boolean state = false;
      @Column(name = "machine_ip")
      private String machineIP;
  
      public void setReservationId(Reservation reservation) {
          this.reservation = reservation;
      }
  
      public String getReservationId() {
          return reservation.getReservationPurpose();
      }
  
      //getters, setters... 
  </code></pre>
  
  <p>If I use getActiveReservationByStatus query I can get the value from reservation table using getters and setters defined in the Reservation class. But I cannot get a values from machineResultList.</p>
  
  <p>How should I modify getMachineResultList getter to be able to pick up information from that List (information from machine table)?</p>