• 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

Hibernate Query Doubt

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

i have an entity class which has the fields firstname and lastname in the string format.

I am writing an hibernate query to select the first name and last name from the particular table .

I am printing the result list returned by the query

My particular selection for the table fetches four row in the table so the result list is printing hashcodes of the four objects

Now , how can i retrieve the first name and last name which i want from each object in the result list ?

Thanks
Mahendra
 
Greenhorn
Posts: 22
MyEclipse IDE Hibernate Postgres Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

For better understanding you can include some code snippet in your post.
I think if you are calling query.list() or query.iterate() as mentioned in http://www.roseindia.net/hibernate/hibernateorderbyexample.shtml then what you will get will be an object of the class that have run your query on. (if your query is "from Cat as cat" then you should expect objects of class "Cat") So in your case you should typecast your objects to appropriate class and then you should get firstname and lastname.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic