title: Typecasting error in StoredProcedure results using Hibernate
body: <p>I have a procedure which tries to return a list of Strings from DB using Hibernate</p>
  
  <pre><code>public List&lt;String&gt; getErrorMessage(int incidentID){
      List&lt;String&gt; returnObj = new ArrayList&lt;String&gt;();
      StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery("dbo.DisplayMessage")
                                             .registerStoredProcedureParameter("IncidentID", Integer.class, ParameterMode.IN)
                                             .setParameter("IncidentID", incidentID);
  
      boolean status = storedProcedure.execute();
      List&lt;Object[]&gt; storedProcedureResults = storedProcedure.getResultList();
      if(storedProcedureResults==null || storedProcedureResults.size()==0)
      {
          return null;
      }
      for(Object[] row: storedProcedureResults) {
          returnObj.add((String)row[0]);
      }
      return returnObj;
  }
  </code></pre>
  
  <p>However, I get an error saying - </p>
  
  <pre><code>java.lang.String cannot be cast to [Ljava.lang.Object;
  </code></pre>
  
  <p>The stored procedure only returns a list of strings. How do I return it back in the function?</p>