Two Laptop Bag
The moose likes JSF and the fly likes retrieve data from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "retrieve data from database" Watch "retrieve data from database" New topic

retrieve data from database

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
I have a very simple JSF application with hibernate. I get values from the user through the above said application and used hibernate mapping files to save data into database and it works fine till that.

In the initial set up, I have a drop down list which I had configured through faces-config.xml file as key and value of a hashmap. I could get the drop down menu and allow the user to select this value and get it as bean and finally saving into database.

Now I would like to add some more features. I would like to get the list (one of the column) from a table(list_table) in the database and display for the users in the web page. How do I achieve this?

1. Do I have to add one more hbm file according to list_table?
2. Then use a separate java class ( with beans ( for the column name as list_table with getter and setter method) and call $list.column name) in my jsf page to display the list for the users.

I haven't tried this and I want to know how to proceed further.

Basically I want to read one column from a table and display as a list in my jsf page. Please give some suggestions.
I agree. Here's the link:
subject: retrieve data from database
It's not a secret anymore!