Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to select all datas from DB using HQL

 
Midhun Sivasankaran
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi EveryOne,

Please help me on selecting all datas from the database (Query).

I want the similar query given below to be in HQL.

'SELECT * FROM TABLE_NAME'

1 way is by giving all the column name with the select query.

Is there any other ways???

Thanks in Advance.

Regards,
Midhun

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good place to start if you are unfamiliar with HQL is this section of the Hibernate documentation.

"selecting all datas from the database" is usually a bad idea, but I think you mean all data from a particular table? If so, the HQL differs a little from the SQL:

will select all data from whatever table that particular class is mapped to returning it as a List of instances of that particular object, and:

will select all data from whatever table that particular class is mapped to returning only those named properties as a List of Object arrays.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic