title: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to my custom model class
body: <p>Hello Everyone i am a bit new with hibernate query result and stuff as per my requirements i have to build a json result from following query i have my model class which i will be returning as json response, The query.getResult() returns me with object class but type casting is not working for me is there any alternate way for this.I want to map the query result with my custom Model Object.</p>
  
  <pre><code> List&lt;Object[]&gt;  result = query.getResultList();
              ListIterator&lt;Object[]&gt; iter = result.listIterator();
              List&lt;ReferFriend&gt; refer=new ArrayList&lt;&gt;();
              while (iter.hasNext()){
                  @SuppressWarnings("unchecked")
                  ReferFriend referFriend=  (ReferFriend) (Object)iter.next();
                  refer.add(referFriend);
              }
              return refer;
          } catch (NoResultException e) {
              return null;
          }
      }
  </code></pre>