|
when i want to do a search on an enum field with only a part of the enum (using a like) i will get a conversion error because the parameter is added as an enum instead of a string. see: http://stackoverflow.com/questions/10825928/perform-jpa-query-with-like-operator-on-entity-with-enum-enumtype-string/21509659#21509659
changing this method will fix this: protected void applyNamedParameterToQuery(Query queryObject, String paramName, Object value) throws HibernateException {
if (value instanceof Collection) { queryObject.setParameterList(paramName, (Collection) value); }
else if (value instanceof Object[]) { queryObject.setParameterList(paramName, (Object[]) value); }
else { queryObject.setParameter(paramName, value); }
}
adding }else if(value instanceof String) { queryObject.setString(paramName, value); }
will fix this.
|