即使我通过整数传递给命名查询的值,我也会收到上面的消息。谁能解释为什么?谢谢
DAO Java 代码
Calendar cal = Calendar.getInstance();
cal.setTime(interval.getStartDate());
query.setParameter("academicYear", new Integer(cal.get(Calendar.YEAR)));
询问:
@NamedQuery(name = "StudentDemographics.findByMOEDEqual", query = "SELECT s.student FROM StudentDemographics s " +
"WHERE :academicYear = s.academicYear " +
"AND UPPER(s.MOED) like :MOED"),
错误:参数值 [2011] 与类型 [java.lang.Integer] 不匹配
环境是 Spring w Hibernate/JQL + SQL Server