-->
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: HQL Issue: Could not execute Query
PostPosted: Fri Jul 28, 2006 2:53 pm 
Newbie

Joined: Fri Jul 28, 2006 2:46 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1.3

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


i am new to hibernate and trying to fetch data from tbl_user table.

My code the query way
tempUser = (User) session.createQuery("from User as usr where usr.userName like 'yog@abc.com'").uniqueResult();

My code the criteria way
Criteria criteria = getSession().createCriteria(getPersistentClass());
criteria.add(Restrictions.eq("userName", (String)user.getUserName()));
tempUser = (User)criteria.uniqueResult();

The SQL generated by Hibernate is:
Hibernate: select user0_.USER_ID as USER1_0_, user0_.userName as userName0_, user0_.password as password0_ from TBL_USER user0_ where user0_.userName like 'yog@abc.com'

This throws an error
The exception is : org.hibernate.exception.SQLGrammarException: could not execute query

Web Server: Tomcat
IDE:Eclipse 3.1

Could anyone help plz...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 29, 2006 4:11 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Could you please post the complete stack trace. this looks like a mapping mistake where you eventually mapped a column / table with a typo.

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject: I got the solution
PostPosted: Sat Aug 12, 2006 2:42 pm 
Newbie

Joined: Fri Jul 28, 2006 2:46 pm
Posts: 2
MikePloed wrote:
Could you please post the complete stack trace. this looks like a mapping mistake where you eventually mapped a column / table with a typo.


Thanx.
It was a silly mistake :) I had a sequence in the hbm file but didn't have one in the oracle db.


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.