-->
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.  [ 2 posts ] 
Author Message
 Post subject: unexpected AST node While using Hibernate
PostPosted: Mon Jan 26, 2009 1:27 pm 
Newbie

Joined: Mon Jan 26, 2009 1:19 pm
Posts: 1
Hi All,

i am new to hibernate so please excuse for my newbie question.
i am trying to fetch data related to User using hibernate.

i have a class namely CustomerBusinessInformationPO where i have put refrence for 2 others classes namely UserCredentialPO and AddressPO.

what i want is when user provide user id and password based on this i must fetch dat related to that user so what i am trying ot do is something like below


SessionUserPO sessionUserPO=null;
session =HibernateSessionFactory.getSessionFactory().openSession();
tx =session.beginTransaction();

//String USEROBJECT_QUERY ="select h from CustomerBusinessInformationPO as h where h.getUserCredentialPO().getEmail()='"+encyptedPassword+"'";
String USEROBJECT_QUERY ="select h from CustomerBusinessInformationPO as h where h.getUserCredentialPO().getEmail()='raisonnetech'";
Query query=session.createQuery(USEROBJECT_QUERY);
List userObject=query.list();
for(Iterator it=userObject.iterator();it.hasNext();){
customerBusinessInformationPO =(CustomerBusinessInformationPO)it.next();
if(customerBusinessInformationPO!=null){

sessionUserPO=new SessionUserPO(customerBusinessInformationPO);
return sessionUserPO;
}
else{
return sessionUserPO;
}

but i am getting the following error:

04:54:00,218ERROR org.hibernate.hql.PARSER {1}:33 -<AST>:1:112: unexpected AST node: (
org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: ( near line 1, column 112 [select h from com.raisonne.billsmart.userobjects.CustomerBusinessInformationPO as h where h.getUserCredentialPO().getEmail()='raisonnetech']

can any one point me what i am doing wrong

thanks in advance,
shekher


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2009 2:36 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
The name of a property when used in HQL doesn't include the 'get' and the first letter should be lower-case. Eg.

Code:
select h from CustomerBusinessInformationPO as h where h.userCredentialPO.email='raisonnetech'


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.