-->
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.  [ 1 post ] 
Author Message
 Post subject: query error
PostPosted: Sun Mar 20, 2005 5:06 pm 
Newbie

Joined: Mon Feb 21, 2005 5:42 pm
Posts: 10
public boolean findUserName(String uname){
SessionFactory instance = Singleton.getPersistenceManager();

boolean result = false;

try {
Session session = instance.openSession();
Transaction tx = session.beginTransaction();
Query q = session.createQuery("from UserDirectory d where d.username = :uname");
q.setParameter("uname", uname);
result = q.list().isEmpty();
tx.commit();
session.close();

} catch (HibernateException e) {
e.printStackTrace();
}
return result;
}

And I receive the following error

net.sf.hibernate.QueryException: in expected: d [from UserDirectory d where d.username = :uname]

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.token(PreprocessingParser.java:123)

at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)

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:294)

at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1562)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533)

at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)

at com.users.core.UserDirectory.findUserName(UserDirectory.java:136)

at com.users.core.UserDirectory.main(UserDirectory.java:176)

Any idea?
King Regards!
Natalia


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

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.