-->
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: Error while executing simplest query
PostPosted: Fri Apr 02, 2004 8:30 am 
Newbie

Joined: Thu Jan 15, 2004 5:04 am
Posts: 6
I execute:

Code:
Query query = session.createQuery("from MerchantPvStats pv");
query.setFirstResult(pageNumber * pageSize);
query.setMaxResults(pageSize);

return query.list(); 


And get exception:
    net.sf.hibernate.QueryException: in expected: stats [from MerchantPvStats stats]
    at net.sf.hibernate.hql.FromParser.token(FromParser.java:102)
    at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
    at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142)
    at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
    at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
    at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
    at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293)
    at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1493)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1464)
    at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
    at paging.HibernatePagingStrategy.getPage(HibernatePagingStrategy.java:28)
    at paging.Main.measurePerformance(Main.java:56)
    at paging.Main.run(Main.java:29)
    at paging.Main.main(Main.java:24)


Could you explain me what's wrong.

Thanks in advance.


Top
 Profile  
 
 Post subject: oups, the correct message should be
PostPosted: Fri Apr 02, 2004 8:34 am 
Newbie

Joined: Thu Jan 15, 2004 5:04 am
Posts: 6
I execute:
Code:
Query query = session.createQuery("from MerchantPvStats stats");
query.setFirstResult(pageNumber * pageSize);
query.setMaxResults(pageSize);

return query.list();

And get exception:

    net.sf.hibernate.QueryException: in expected: stats [from MerchantPvStats stats]
    at net.sf.hibernate.hql.FromParser.token(FromParser.java:102)
    at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
    at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142)
    at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
    at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
    at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
    at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293)
    at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1493)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1464)
    at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
    at paging.HibernatePagingStrategy.getPage(HibernatePagingStrategy.java:28)
    at paging.Main.measurePerformance(Main.java:56)
    at paging.Main.run(Main.java:29)
    at paging.Main.main(Main.java:24)



Could you explain me what's wrong.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 02, 2004 1:48 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The class must be mapped. If so, use the fully qualified class name.

_________________
Emmanuel


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.