title: Spring + Java: Timestamp cannot be cast to Date? Pulling from SQL but type is Date. No Timestamp in code
body: <p>I'm currently using the Spring framework, though I'm not sure if this is directly the issue. I'm getting the following error:</p>
  
  <p><code>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:929)
      org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:824)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:798)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)</code></p>
  
  <pre><code>    @SuppressWarnings({ "rawtypes", "unchecked"})
  public List getAllByFilter( String collectionPeriod,String sYear, String submission) {
      // TODO Auto-generated method stub SELECT_QUERY_BY_COLL_MSTR
  
      List&lt;CollectionCalendar&gt; orgs1 = new ArrayList&lt;CollectionCalendar&gt;();        
      List&lt;Map&lt;String,Object&gt;&gt; rows1 = null;
      String query="SELECT_QUERY_BY_COLL_MSTR";
  
      if("All".equalsIgnoreCase(sYear) &amp;&amp; "All".equalsIgnoreCase(collectionPeriod)){
          query="SELECT_QUERY_BY_COLL_MSTR_SUBMISSION";
           rows1 = getJdbcTemplate().queryForList(p.getProperty(query),new Object[] {submission});
      }else if(!"All".equalsIgnoreCase(sYear) &amp;&amp; "All".equalsIgnoreCase(collectionPeriod)){
          query="SELECT_QUERY_BY_COLL_MSTR_SUBMISSION_YEAR";
           rows1 = getJdbcTemplate().queryForList(p.getProperty(query),new Object[] {sYear,submission});
      }else if("All".equalsIgnoreCase(sYear) &amp;&amp; !"All".equalsIgnoreCase(collectionPeriod)){
          query="SELECT_QUERY_BY_COLL_MSTR_SUBMISSION_COLLECTION";
           rows1 = getJdbcTemplate().queryForList(p.getProperty(query),new Object[] {collectionPeriod,submission});
      }else if(!"All".equalsIgnoreCase(sYear) &amp;&amp; !"All".equalsIgnoreCase(collectionPeriod)){      
           rows1 = getJdbcTemplate().queryForList(p.getProperty(query),new Object[] {sYear,collectionPeriod,submission});
      }
      System.out.println("hellooooooooooooooooooo");
      for (Map row : rows1) {
          System.out.println("row------"+row);
          CollectionCalendar collectionCalendar = new CollectionCalendar(row.get("COLL_KEY").toString(),
                  (Date)row.get("COLL_OPEN_DT"),
                  (Date)row.get("COLL_CLOSE_DT"),
                  (Date)row.get("COLL_AVLBL_DT"),
                  row.get("COLL_ACAD_YR").toString(),
                  row.get("COLL_NAME").toString(),
                  row.get("COLL_DESC").toString(),
                  row.get("SUBM_DESC").toString(),
                  row.get("UPDATE_USER").toString());
                  //(Timestamp) row.get("UPDATE_DTTM"));            
          orgs1.add(collectionCalendar); (COMMENTED THIS OUT BUT STILL GETTING ERROR)
      }
      return orgs1;
  }
  
  public CollectionCalendar(String colKey,Date opDate,Date clDate,Date avDate,String sYear,String submission,String collectionPeriod,String subDesc,String updateUser){
      setCollKey(colKey);
      setOpenDate(opDate);
      setCloseDate(clDate);
      setAvailDate(avDate);
      setsYear(sYear);
      setSubmission(submission);
      setCollectionPeriod(collectionPeriod);
      setSubDesc(subDesc);
      setUpdateUser(updateUser);
      //setUpdateTime(updateTime);
  }
  </code></pre>
  
  <p>What I have is a search form that queries the DB and returns results into a table. I'm pulling data from Oracle DB table where the column type is <code>Date</code> but for some reason it's telling me that it cannot cast from a <code>Timestamp</code> value. I'm not requesting a <code>Timestamp</code> value at all.</p>
  
  <p>Any help is greatly appreciated.</p>