• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Query Doubt

 
Mahendra Chowdary
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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
 
Gupta Tarun
Greenhorn
Posts: 22
Hibernate MyEclipse IDE Postgres Database
  • Mark post as helpful
  • send pies
  • 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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic