-->
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: issue in hql query
PostPosted: Wed Jun 06, 2012 4:33 am 
Newbie

Joined: Wed Jun 06, 2012 4:08 am
Posts: 1
Hi friends,
I am facing a problem in a hql query, which is describe as below:

Query cityQuery=session.createQuery(" from City where cityCode=:paramCityCode ");
City city=(City )cityQuery.setString("paramCityCode", cityCode1).uniqueResult();


corresponding sql query generated by hibernate is :

select city0_.city_name as cit1_26_, city0_.city_code as cit2_26_ from city city0_ where (cityCode=? )
which is causing error on database-server, which is obvious bcoz there should be city_code instead of cityCode.

but it should generate like this:
select city0_.city_name as cit1_26_, city0_.city_code as cit2_26_ from city city0_ where city_code=? .

I have done proper hbm. mapping too, if not then city0_.city_code should not come.

I am unable to track the cause. I am using hibernate3.0.
Please let me know if i am doing something wrong somewhere, or I need to do some other configuration.

Thanks in advance


Top
 Profile  
 
 Post subject: Re: issue in hql query
PostPosted: Wed Jun 06, 2012 10:43 am 
Beginner
Beginner

Joined: Mon Jun 04, 2012 12:31 pm
Posts: 20
Could you post the hibernate mapping file?

Have you tried using an alias for the entity?


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.