title: [Ljava.lang.Object; cannot be cast to
body: <p>I want to get value from the database, in my case I use <code>List</code> to get the value from the database but I got this error </p>
  
  <pre><code>Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to id.co.bni.switcherservice.model.SwitcherServiceSource
  at id.co.bni.switcherservice.controller.SwitcherServiceController.LoadData(SwitcherServiceController.java:48)
  at id.co.bni.switcherservice.controller.SwitcherServiceController.main(SwitcherServiceController.java:62)
  </code></pre>
  
  <p>this is my code </p>
  
  <pre><code>    Query LoadSource = session_source.createQuery("select CLIENT,SERVICE,SERVICE_TYPE,PROVIDER_CODE,COUNT(*) FROM SwitcherServiceSource" +
              " where TIMESTAMP between :awal and :akhir" +
              " and PROVIDER_CODE is not null group by CLIENT,SERVICE,SERVICE_TYPE,PROVIDER_CODE order by CLIENT,SERVICE,SERVICE_TYPE,PROVIDER_CODE");
      LoadSource.setParameter("awal", fromDate);
      LoadSource.setParameter("akhir", toDate);
  
      List&lt;SwitcherServiceSource&gt; result_source = (List&lt;SwitcherServiceSource&gt;) LoadSource.list();
      for(SwitcherServiceSource tes : result_source){
          System.out.println(tes.getSERVICE());
      }
  </code></pre>
  
  <p>any help will be pleasure :)</p>
  
  <p>@raffian, did you mean like this??</p>
  
  <pre><code>List&lt;Switcher&gt; result = (List&lt;Switcher&gt;) LoadSource.list();
  for(Switcher tes : result){
      System.out.println(tes.getSERVICE());
  }
  </code></pre>