• 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
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Class design

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to represent a resultset in a tabular form (html table).
I normally use objects (Eg: Product, Employee etc) for simple cases to represent product or employee data from product table or employee table.
I am having a report kind of data where it has to query more than 5 tables and represent two columns from each table in a UI. The DBA provides me a database view, I need to query this. How should my object look like?
The tables are having parent-child relationship, I feel there will be too much work in splitting objects from resultset and then putting them together to represent in UI (JSP). Can I have my class look like what I need in my UI ?? I use DAO pattern with straight JDBC / SQL queries.

Thanks in Advance,
Vinod
 
Ranch Hand
Posts: 693
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I need to represent a resultset in a tabular form (html table).

OK, I'm with you so far. I've heard that an HTML table is the right choice to represent tabular data.

> I normally use objects (Eg: Product, Employee etc) for simple cases to represent product or employee data from product table or employee table.

OK. That sounds good to me too.

> I am having a report kind of data where it has to query more than 5 tables and represent two columns from each table in a UI. The DBA provides me a database view, I need to query this. How should my object look like?

Can you do a JOIN in SQL and use an object of the class java.sql.ResultSet to hold the data?

> The tables are having parent-child relationship, I feel there will be too much work in splitting objects from resultset and then putting them together to represent in UI (JSP). Can I have my class look like what I need in my UI ?? I use DAO pattern with straight JDBC / SQL queries.

I don't understand. I looked up DAO on www.wikipedia.org. I am learning. I don't understand why you would need to split up the resultset and put it backtogether in the UI. Isn't the resultset of the JOIN exactly the tabular data that the HTML table is designed to display using a JSP?

Kaydell
[ May 29, 2007: Message edited by: Kaydell Leavitt ]
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vinod,
I think you need not split the result set. Just create a class containin the fields that you want in your table (i.e UI) and then render it on the jsp.
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!