title: [Ljava.lang.Object; cannot be cast to error
body: <p>I get a list from my <code>query.list()</code>. After that, I want to display the object inside this list but I got this error for this line <code>for(Commerce[] c: this.newsList) {</code></p>
  
  <blockquote>
    <p>java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lcom.model.Commerce;
        com.action.CommerceAction.searchCommerces(CommerceAction.java:35)</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <p>My business service</p>
  
  <pre><code>public List&lt;Commerce[]&gt; getCommercesBySearch(String categorie, String lieux) {
      Query query = hibUtil.getSession().createQuery("from Commerce c, Categorie ca,Lieux l "
              + "where c.categorie=ca.idCategorie and c.lieux=l.idLieux and"
              + " ca.libelle='" + categorie + "' and l.ville='" + lieux + "' ");
      List&lt;Commerce[]&gt; tuples = (List&lt;Commerce[]&gt;) query.list();
      return tuples;
  }
  </code></pre>
  
  <p>My action class</p>
  
  <pre><code>private CommerceService service;
  private Commerce commerce = new Commerce();
  private List&lt;Commerce[]&gt; newsList;
  public String searchCommerces() {
      String libelle = ServletActionContext.getRequest().getParameter("libelle");
      String ville = ServletActionContext.getRequest().getParameter("ville");
      this.newsList = service.getCommercesBySearch(libelle,ville);
      for(Commerce[] c: this.newsList){
          System.out.println(c[0].getNom());
      }
      if (this.newsList.size() &gt; 0) {
          return SUCCESS;
      }
      addActionError("Il n'existe aucun commerce de cette catégorie dans cette ville");   
      return ERROR;
      }
  </code></pre>