Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Hibernate Query Doubt

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 ?

Posts: 22
MyEclipse IDE Hibernate 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 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.

Destroy anything that stands in your way. Except this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic