title: How to retrieve the data based on the relationship in hibernate
body: <p>am new to Hibernate.
    I have two tables named "User" and "Details". These two tables are mapped as " one-to-many ".
  The mapping process is given as follow.</p>
  
  <pre><code>    @Entity
      public class User { 
      private int id;
      private Strng name;
  
      @OneToMany(mappedBy ="user" )
  
      private Collection&lt;Details&gt; details;//= new ArrayList&lt;Details&gt;();
      ....getters and setters.....
     }
  </code></pre>
  
  <p>and Details class is </p>
  
  <pre><code>    @Entity
      public class Details{ 
      private int id;
      private Strng address;
      private String deleted;
      }
  </code></pre>
  
  <p>And this one to many relation works fine..</p>
  
  <p>Now i want to retrieve the data from " details " table of particular record in " user " table with an additional condition ie, "deleted " field is equal to the string  "NO".</p>
  
  <p>For this requirement hibernate, how can i achieve this one.</p>
  
  <p>Filters or criteria or some one else ,, which one is the best way to solve my problem, with out break the relation.</p>
  
  <p>I mean , with the help of relations we simple get all the data at single line of code, like " user_obj.getDetails()" .  In the same way we can simple get the data from the data base with extra conditions with less code.</p>
  
  <p>Thank u to all,, in advance.......</p>