• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HQL difference in these two queries.

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please let me know if there is any difference in between these two?? If not then why there are two versions ?

"from Insurance where lngInsuranceId='1' "


"Select insurance.lngInsuranceId from Insurance
insurance where insurance.
lngInsuranceId='1'";


Thanks in advance .
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes there is. The Hibernate documentation covers what that difference is, rather than repeating that here I suggest you go have a read. Its the section 14.6 "The select clause".

Feel free to ask supplementary questions if you don't follow the docs.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Feel free to ask supplementary questions if you don't follow the docs.


Thanks
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The documentation is very hard to understand . Its very confusing.

With my question :

"The select clause picks which objects and properties to return in the query result set."

I am confused with this because , ultimately the return type is Query and we need to perform query.list() at last . so what does above statement actually mean ?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read on beyond the first sentence. Your answer is in the documentation.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read No use . . May be my brain filled with sand and mud.

Leave it , l am not forcing you to answer me.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out

There is a difference between these two queries .

select clause for selecting object properties and from clause is for getting whole object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic