my dog learned polymorphism
The moose likes Object Relational Mapping and the fly likes A query with HQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "A query with HQL " Watch "A query with HQL " New topic

A query with HQL

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

I am praticing Hibernate HQL through Eclipse HQL Editor .

Could anybody please let me know why the FIrst Statement is executed while the second throws an Error .

select NAME , PASSWORD from Users 1st query

select * from Users
2nd query

Please suggest . Thank

Save India From Corruption - Anna Hazare.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Impossible to say without knowing what error is thrown. Both look OK (though the property names in the first look a bit suspect for a Java class).

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thanks Paul ,

You were correct that without seeing the POJO types we cant say whats the problem in case of writing HQL .

Assume taht this is my code inside a Java Object .

I just want to ask that , is it possbile to use normal SQL queries within @Namedquery , or should it be HQL queries only

Please advice , thanks .
I agree. Here's the link:
subject: A query with HQL
It's not a secret anymore!