• 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

transpose ResultSet for JSP display

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a ResultSet object derived from a 1:N join

In my display/report/JSP (really
 
Riley Brook
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a ResultSet object derived from a 1:N join


In my JSP I would like to display that as ONE line item:

What's the best way to go about doing this?
Approach (?) Create a business object (OrderNum) and do the relational mapping in the bean code. Have the JSP use the bean.
Cons: This seems wasteful to create java objects for this pupose. There will be many OrderNums and they are shortlived objects.
Any other ideas? This is a repeatable problem throghout my app and I would like to apply this approach globally.
 
Ranch Hand
Posts: 687
Hibernate jQuery Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Riley...
u can create a Java DVO (Data Value Object or business object as u say....) to hold this results and send the result on to the jsp .
Anyway to communicate between the jsp and the class from where u r making the database call will be much more simpler and user defined if u use dvo's .
The DVO can have request scope by setting it in the request hence the scope of them also will be controlled and they will be eligible for gc as soon as the request from the jsp is completed.
another approach is using the result set itself which is absolutely not recomemded in the jsp....!!!
u'r idea of a business object is good enuf and will provide u with the control for the messaging protocol between the jsp and the class which is doin the database calls.
 
Riley Brook
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
devesh -- thanks for the reply
I agree I wouldn't want to actually use the resultset in the jsp and putting whatever DVO in the request scope will allow "messaging" between the tiers.
I guess my concern was around overhead of creating composite objects that will be so shortlived, then having the GC destroy them afterwards.
We have a data object (think disconnected resultset) which has all the mutators of a resultset but has already disconnected from the db. Its really a vector of vectors. Usually the row vector corresponds to a row in the display so its easy to loop through. In this case (one to many) the idea breaks down.
I'm concerned about now creating a DVO object(order) from my object described above which will have a hash of other objects (items) which might have hash of other objects (tbd) per request. Many users, many requests this can add up (?)
Seems memory heavy and wasteful? No? Should I not be concerned about this?
 
He baked a muffin that stole my car! And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic