-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: QueryException: Criteria not finding my columns
PostPosted: Tue Mar 18, 2008 11:38 am 
Beginner
Beginner

Joined: Wed Mar 05, 2008 10:32 am
Posts: 48
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 21, 2008 2:42 pm 
Beginner
Beginner

Joined: Wed Mar 05, 2008 10:32 am
Posts: 48
Anyone have any ideas as to why?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 6:43 pm 
Beginner
Beginner

Joined: Wed Mar 05, 2008 10:32 am
Posts: 48
bump


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.