Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class design

 
Vinod Kumar
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
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • 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 ]
 
Dhaval Shah
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic