title: Hibernate 5.2 version -> A lot of Query methods deprecate?
body: <p>I'm new to Hibernate.</p>
  
  <p>I'm trying to get a list of first name and last name of all administrators.</p>
  
  <p>There are two warnings in my following code. I already tried to search a lot online.</p>
  
  <p>1) Query is a raw type. References to generic type Query should be parameterized.</p>
  
  <p>2) The method list() from the type Query is deprecated.</p>
  
  <pre><code>public List&lt;Object&gt; loadAllAdmins() {
                  List&lt;Object&gt; allAdmins = new ArrayList&lt;Object&gt;();
                  try {
                          HibernateUtil.beginTransaction();
  
                          Query q = currentSession.createQuery("SELECT admin.firstName, admin.lastName from AdminBean admin");
  
                          allAdmins= q.list();
  
                          HibernateUtil.commitTransaction();
                  } catch (HibernateException ex) {
                          System.out.println("List&lt;AdminBean&gt; loadAllPersons: HibernateException");
                  }
                  return allAdmins;
          }
  </code></pre>
  
  <p>But I see sample code like this all over the web. How should I solve these two problems?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I just tried to use Criteria as suggested. It also says the list() method is deprecate for Criteria... It seems that a lot of methods are deprecate for both Query and Criteria, including uniqueResult() and others... Any suggestion how I should replace them?</p>