因为持久属性projectNo的
Long类型是,所以创建Parameterexpression时的type参数应该是
Long。因此,由于Parameterexpression的
Long类型为,因此参数值的类型也应为Long:
//because this persistent Attribute is Long:private Long projectNo;//we use Long here as wellParameterexpression<Long> pexp = cb.parameter(Long.class, "projectNo");...//and finally set parameter. Long again, because that is the type // type of Parameterexpression:query.setParameter("projectNo", Long.valueOf(projectNo));

![休眠参数值[568903]与预期的类型[java.lang.Long]不匹配 休眠参数值[568903]与预期的类型[java.lang.Long]不匹配](http://www.mshxw.com/aiimages/31/498165.png)
