• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to select all datas from DB using HQL

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic