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.
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.
Joined: Oct 24, 2002
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?