title: How to implement where condition in one-to-one relationship
body: <p>I am trying to implement the below 'example' query in JPA. It is a ONE-TO-ONE relationship. </p>
  
  <p>select * from Person person, Age age where person.age between age.minAge and age.maxAge</p>
  
  <p>In my real project, i have multiple Where conditions like this and i want to know the most effective way of achieving the same using annotations. </p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>@Entity
  @Table(name = "PERSON")
  public class Person 
  {
      @Column(name = "NAME", nullable = false, precision = 0)
      private String name;
  
      @Column(name = "ADDRESS", nullable = false, precision = 0)
      private String address;
  
      @Column(name = "AGE", nullable = false, precision = 0)
      private int age;
  
      private BMIForAge bmi_age;
  
      **@OneToOne(optional = false, fetch = FetchType.EAGER)
      public BMIForAge getBmi_age() {
          return bmi_age;
          }
  
          public void setBmi_age(BMIForAge bmi_age) {
          this.bmi_age = bmi_age;
      }**
  }
  
  
  @Entity
  @Table(name = "BMI_FOR_AGE")
  public class BMIForAge
  {
      @Column(name = "MIN_AGE", nullable = false, precision = 0)
      private int minAge;
  
      @Column(name = "MAX_AGE", nullable = false, precision = 0)
      private int maxAge;
  
      @Column(name = "BMI", nullable = false, precision = 0)
      private int bmi;
  ...
  }
  </code></pre>