• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A Very little problem in h:dataTable implementation

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all! I'm having a bean class employee having attributes id,name along with public getters and setters.

I'm using following bean for db connection and getting values from database table.

TableBean.java:



Following is jsf page:



Kindly reply.
Thanks in advance.
 
Bartender
Posts: 1845
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I would say that your problem is in your data layer.

Question: What do you expect the ResultSet returned from this method to do?

Fun fact #1: You cannot access data in a result set that is closed
Fun fact #2: You close the results set in the finally statement of your method which returns the result set.

I suspect that might be the technical source of your problem.

In general, returning a ResultSet from a method is normally a bad idea.
The standard practice is to iterate of all the results in the result set, store them into a List of Beans, close the result set, and return the List of beans.

 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic