title: Cannot cast List<Object> return type of HibernateTemplate.findByCriteria(criteria)
body: <p>I am trying to get records using HibernateTemplate.findByCriteria(criteria).</p>
  
  <p>It is returning List and I am trying to cast it to List but it does not allow me for that. How to cast List to List?</p>
  
  <p>Here is my code example:</p>
  
  <pre><code>public List&lt;User&gt; getUserList(String status, String type)
      {
          DetachedCriteria joinCriteria = DetachedCriteria.forClass(UserDetails.class)
                                                          .add(Restrictions.eq("status", status));
          DetachedCriteria criteria = joinCriteria.createCriteria("user")
                                                  .add(Restrictions.eq("type", type));
  
  
          return (List&lt;User&gt;) template.findByCriteria(criteria); // Gives error "Cannot cast from List&lt;Object&gt; to List&lt;User&gt;"
      }
  </code></pre>