I'm trying to do a search and i'm getting the following error:
Code:
SEVERE: Servlet.service() for servlet Search threw exception
org.hibernate.QueryException: could not resolve property: name of: com.epixentertainment.model.UserEnt
Here is my call
Code:
public List<UserEnt> searchUsers(String query, String orderProperty, String orderDirection, Long first, Long max){
Criteria criteria = getSession().createCriteria(UserEnt.class);
//match the query in either name or login
criteria.add(Restrictions.or(Restrictions.or(Restrictions.ilike("firstName", query, MatchMode.ANYWHERE),
Restrictions.ilike("lastName", query, MatchMode.ANYWHERE)),
Restrictions.ilike("login", query, MatchMode.ANYWHERE)));
//add the order
if (orderDirection.toLowerCase().equals("asc"))
criteria.addOrder(Order.asc(orderProperty));
else
criteria.addOrder(Order.desc(orderProperty));
//fetch count
criteria.setFirstResult(first.intValue()).setMaxResults(max.intValue());
return criteria.list();
}
and here is my class
Code:
public class UserEnt implements Serializable{
...
/** The first name. */
private String firstName;
/** The last name. */
private String lastName;
/** The login. */
private String login;
...
Seems to be looking for the column named : "name" and rightfully so its not finding it, but why its looking for that and not "firstName" or "lastName" or "login" is not making any sense.
Latest versions of hibernate core and annotations