I am using Hibernate 4 and I have a filter in JSF page to get search results. During execution of search I am getting the following exception
java.la
Because type of persistent attribute projectNo is Long, type argument when creating ParameterExpression should be Long. And consequently, because type of the ParameterExpression is Long, type of the parameter's value should be Long as well:
//because this persistent Attribute is Long:
private Long projectNo;
//we use Long here as well
ParameterExpression 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));