aspose file tools
The moose likes Object Relational Mapping and the fly likes Error related to Hibernate Query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Error related to Hibernate Query " Watch "Error related to Hibernate Query " New topic
Author

Error related to Hibernate Query

Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hi ,

This is the error that the stacktrace displays every time i try to execute the query


the code where this error pops up




What does the error indicate ?


All's well that Debugs well .
rohit chavan
Ranch Hand

Joined: Oct 08, 2010
Posts: 86

Query q = session.createQuery("from user where username= :user and password =:pass");
You need to write the entire query that you can actually execute.
You should have usedin the above line.
Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hi ,

I did try that too . Same kind of error occurred . Will make the changes and post the updated stackTrace .

Thanks and Regards
Varun
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1282

First of all you are dealing with classes (case sensitive) is it really 'user' and not 'User'?

If that is not the problem then what kind of hibernate properties do you have set? Are things defined correctly in your cfg file?

Lastly try fully qualifying it (this should not be necessary but may be if your configurations are not correct)


*this assumes your class is user and not User


[How To Ask Questions][Read before you PM me]
Varun Nambuthiri
Ranch Hand

Joined: Sep 20, 2010
Posts: 76
Hey ,

Thanks Bill and Rohit , I have managed to solve it thanks to your advice Bill . I was using the table name in the DB (user) and not the class name (which was User) in the query .

so the query should have been

I will say this one more , This place is the best !! Thank you guys .Hope one day i will have learnt enough to start giving back to Ranch ..

Thank you
Regards
Varun
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Error related to Hibernate Query
 
Similar Threads
. java.lang.IllegalArgumentException: callable not yet supported for native queries
Named no know - Hibernate
Class Cast Exception
File Upload not working as expected with javascript,ajax, struts
connection, pool exhausted ???