title: How to use Restrictions in Hibernate 5.2
body: <p>From Hibernate 5 Create criteria has been deprecated. Instead we can use Create query. But how to add restrictions now. Please anyone help me with this</p>
  
  <pre><code>public List&lt;ExpensesSummary&gt; displayExpense() {
      Session session = getSessionFactory().openSession();
      CriteriaBuilder builer = session.getCriteriaBuilder();
      CriteriaQuery&lt;ExpensesSummary&gt; criteria = builer.createQuery(ExpensesSummary.class);
      List&lt;ExpensesSummary&gt; expensesList = session.createQuery(criteria).getResultList();
      return expensesList;
  }
  </code></pre>