title: Error in 'and' method of Hibernate Criteria
body: <blockquote>
    <p>Hello,I am new to Hibernate and i was trying to execute and() method in Hibernate Criteria Queries using Eclipse but the LogicalExpression will show error like</p>
  </blockquote>
  
  <p><strong>The method and(Criterion, Criterion) in the type Restrictions is not applicable for the arguments (Criteria, Criteria)</strong></p>
  
  <pre><code>package actions;
  
  import java.util.Iterator;
  import java.util.List;
  
  import org.hibernate.Criteria;
  import org.hibernate.Query;
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  import org.hibernate.criterion.LogicalExpression;
  import org.hibernate.criterion.Restrictions;
  
  public class Andrestriction {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          SessionFactory sf=new Configuration().configure().buildSessionFactory();
          Session sn=sf.openSession();
  
          Criteria cr=sn.createCriteria(PC.class);
  
          Criteria id=(Criteria) Restrictions.gt("id",11);
          Criteria os=(Criteria) Restrictions.ilike("os","d%");
  
          LogicalExpression and=Restrictions.and(id,os); //This line will show error like this:-
  
          //The method and(Criterion, Criterion) in the type Restrictions is not 
          //applicable for the arguments (Criteria, Criteria)
  
          cr.add(and);
  
          List l=cr.list();
          Iterator itr=l.iterator();
          while(itr.hasNext())
          {
              PC p=(PC)itr.next();
              System.out.println(p.getId()+"\t"+p.getName()+"\t"+p.getOs());
  
          }
  
          sn.close();
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p>I want to use and criteria in my Query.Please tell me how to Solve this problem.
    Thanks in advance</p>
  </blockquote>