title: java.lang.ClassCastException: java.util.ArrayList cannot be cast to antlr.collections.List
body: <p>If I do not do type casting to query.list(); to (List)query.list(); it gives me these errors.</p>
  
  <p><a href="https://i.stack.imgur.com/OJBxy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OJBxy.png" alt="enter image description here"></a>
   <a href="https://i.stack.imgur.com/BwT1r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BwT1r.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>java.lang.ClassCastException: java.util.ArrayList cannot be cast to
    antlr.collections.List</p>
  </blockquote>
  
  <p>on calling a method</p>
  
  <pre><code>category= new Category();
  ArrayList data= (ArrayList) category.getCategoryInfo();
  </code></pre>
  
  <p>and method is</p>
  
  <pre><code>public List  getCategoryInfo(){
        Session session = HibernateUtil.openSession();
  
        String sql = "SELECT category.id as id, category.name,c.name as parent_category FROM category join category as c on c.id=category.parent_id"; 
        SQLQuery query = session.createSQLQuery(sql);
        query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); 
        List data = (List) query.list();
        return data;
  }
  </code></pre>
  
  <p>Please help me what is wrong with this code.</p>