my dog learned polymorphism
The moose likes Object Relational Mapping and the fly likes How to display DB table values? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to display DB table values?" Watch "How to display DB table values?" New topic

How to display DB table values?

bharat patel

Joined: Sep 26, 2007
Posts: 1
Well, I am working on Spring with Hibernate. I am able to save values to my database using the HibernateTemplate's saveorupdate(). Now all I want is to display the values from the database tables onto my UI. I need the JSP code as well as the changes that I have to make to My DAO to show the values.

Below is the DAO that I an using.
public class BulletinDAO {
private HibernateTemplate hibernateTemplate;

public HibernateTemplate getHibernateTemplate() {
return hibernateTemplate;

public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
this.hibernateTemplate = hibernateTemplate;

public void setSessionFactory(SessionFactory sessionFactory) {
this.hibernateTemplate = new HibernateTemplate(sessionFactory);

public BulletinBO getBulletin(Long id) {
return (BulletinBO) getHibernateTemplate().get(BulletinBO.class, id);

public List getBulletins() {
BulletinBO bulletinBO =new BulletinBO();
List bulletins = getHibernateTemplate().find("from BulletinBO");
for (int i=0; i<bulletins.size(); i++){
return bulletins;


public void saveBulletin(BulletinBO bulletinBO) {

public void removeBulletin(Long id) {
Object record = getHibernateTemplate().load(BulletinBO.class, id);


Here the BO extension means it is a business object.

Any help would be highly appreciated.

Thanks in advance

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Welcome to JavaRanch!

Hibernate questions go in our O/R forum; I'll move this for you.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jason Ferguson
Ranch Hand

Joined: Sep 16, 2007
Posts: 47
Hi Bharat,

Take a look at the DisplayTag library:

DisplayTag will take a Collection object and output it into an HTML table in a JSP. I _think_ this is what you are asking.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Unfortunately, it kind of looks like two different questions here. One that is ORM related to query the database and get data, but the displaying in on a JSP page should be asked in the JSP forum.

I am not moving this thread, but understand that you probably won't get the JSP portion of the question answered here and that you might need to post that part of the question in the JSP forum.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: How to display DB table values?
It's not a secret anymore!