• 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Retrieving data from Hibernate

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I'm programming a JSF+hibernate web application wit Netbeans 7.2.
I'm trying to populate a selectOneMenu with data from the database with this code:



The code above works fine (HQL and so on...) but there is a problem. The selectOneMenu gets populated with what seems SelectItems with the Object.toString(), not the CODE and DESCRIPTION.
I have debugged the data and it seems that the objects returned by the LIST are composed of 2 String (CODE, DESCRIPTION).
How can I do to transform the Object returned by the query.LIST into a SelectItem???

Thanks in advance!!
 
Jesus Schneider
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, it's easier after you take a closer look at the data.



 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!