title: Hibernate - Parameter value [2011] was not matching type [java.lang.Integer]. How to solve?
body: <p>I am getting the message above even though the value I'm passing through an Integer to the named query.
  Can anyone explain why?
  Thanks</p>
  
  <p>DAO Java Code</p>
  
  <pre><code>Calendar cal = Calendar.getInstance();
  cal.setTime(interval.getStartDate());        
  query.setParameter("academicYear", new Integer(cal.get(Calendar.YEAR)));
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>@NamedQuery(name = "StudentDemographics.findByMOEDEqual", query = "SELECT s.student FROM StudentDemographics s " +
              "WHERE :academicYear = s.academicYear " +
              "AND UPPER(s.MOED) like :MOED"),
  </code></pre>
  
  <p>Error:
  Parameter value [2011] was not matching type [java.lang.Integer]</p>
  
  <p>Environment is Spring w Hibernate/JQL + SQL Server</p>