title: java.lang.ClassCastException: java.lang.Long cannot be cast to [Ljava.lang.Long; on iterating through values from the db
body: <p>I am trying to fetch the last data in a table using hibernate as shown in the following snippets</p>
  
  <pre><code>query.setMaxResults(1);
           List&lt;Long[]&gt; rows =  query.list();
           System.out.println("current row&gt;&gt;&gt;&gt;&gt;&gt;  " +rows.toString());
  
            for (Long[] row: rows) {
                  System.out.println(" ------------------- ");
                  long val = (Long) row[6];
                  System.out.println("current file: " + val);
              }
  
            }catch(Exception ex){
                ex.printStackTrace();
            }
  </code></pre>
  
  <p>this is my query</p>
  
  <pre><code>Query query = session.createQuery("select f.currentfile.id from File f order by f.id DESC");
  </code></pre>
  
  <p>I am having the error at this line of the code</p>
  
  <pre><code>java.lang.ClassCastException: java.lang.Long cannot be cast to [Ljava.lang.Long;
  for (Long[] row: rows) {
  </code></pre>
  
  <p>Please what could be wrong?</p>