RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
I send elements of the ResultSet to a String[] and pass it to the presentation tier. Mark -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 12:43 PM You can't store a ResultSet in an HttpSession because it's not Serializable. If you can't fit the result into memory, I would create an Iterator implementation that loops over a ResultSet and pass that to the presentation tier (Servlet or JSP) for rendering. That way you isolate the data retrieval details (ie. ResultSet) from the next layer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
--- Pat Quinn <[EMAIL PROTECTED]> wrote: > > I have a requirement to cater for a large number of results returned to > the > presentation tier. I've taken a quick look into the Value List Handler > Design pattern > (http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html). > > I do agree it offers some advantages but in my opinion it doesn't > satisfy > its goal. From the sample code it appears that the SQL Resultset is > completely loaded and represented as a list of Transfer Objects. When > dealing with a large result this will have a negative impact on > performance > as it must create a TO for each record. > > I could make some changes to increase performance i.e. > > Store the ResulSet as a member of the ValueListHandler Object and only > load > the data from the resultset as and when i need it. If i store the > ValueListHandler in HttpSession i got to ensure i close all connections > before disposing of it, other wise i could max out on cursors. You can't store a ResultSet in an HttpSession because it's not Serializable. If you can't fit the result into memory, I would create an Iterator implementation that loops over a ResultSet and pass that to the presentation tier (Servlet or JSP) for rendering. That way you isolate the data retrieval details (ie. ResultSet) from the next layer. David > > > Anyone got any ideas/suggestion as to how best to implement such > functionality? > > _ > The new MSN 8: smart spam protection and 2 months FREE* > http://join.msn.com/?page=features/junkmail > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
Pat Quinn wrote: where do you keep the initial resultset? Or do you execute the query each time the user requests to page? What would be nice if i could execute an sql statement which would give me a sub set of the results as contolled by a start and end position i specify e.g. Select code, desc from products where ROW_NUM >= 1 and ROW_NUM <= 10 Some databases let you specify a LIMIT clause, which limits the results to whatever you specify, and an OFFSET clause, which starts the results at the indicated offset. Using these you can achieve an elegant subset of results based on start and end position (and it is IMHO the best way to implement the kind of feature you're describing). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
Paananen, Tero wrote: The disadvantage of this approach is that you'll be tieing your implementation to a specific db vendor at that point. DB vendors implement such functionality differently, from what I've seen. Yep. I've yet to see an application that does NOT target a specific db though. YMMV. There's the rub -- the language and deployment environments are for the most part pretty good at cross-platformedness. The DBs have a ways to go. :( Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
Have you checked out OJB yet? I use google like paging in all my applications and OJB lets me use any database I want. Its worth a look at any rate. http://db.apache.org/ojb Cheers, Graham -Original Message- From: Paananen, Tero [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 2:13 PM To: 'Struts Users Mailing List' Subject: RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern > Some databases let you specify a LIMIT clause, which limits > the results > to whatever you specify, and an OFFSET clause, which starts > the results > at the indicated offset. Using these you can achieve an > elegant subset > of results based on start and end position (and it is IMHO > the best way > to implement the kind of feature you're describing). The disadvantage of this approach is that you'll be tieing your implementation to a specific db vendor at that point. DB vendors implement such functionality differently, from what I've seen. I've yet to see an application that does NOT target a specific db though. YMMV. -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
hows my SQL not great me thinks its got to be something to do with rownum in my case as its an oracle database. From: Erik Price <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Re: [OT] Rendering Large ResultSet - Value List Handler Design Pattern Date: Tue, 12 Aug 2003 13:06:59 -0400 Pat Quinn wrote: where do you keep the initial resultset? Or do you execute the query each time the user requests to page? What would be nice if i could execute an sql statement which would give me a sub set of the results as contolled by a start and end position i specify e.g. Select code, desc from products where ROW_NUM >= 1 and ROW_NUM <= 10 Some databases let you specify a LIMIT clause, which limits the results to whatever you specify, and an OFFSET clause, which starts the results at the indicated offset. Using these you can achieve an elegant subset of results based on start and end position (and it is IMHO the best way to implement the kind of feature you're describing). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
--- Mark Galbreath <[EMAIL PROTECTED]> wrote: > I send elements of the ResultSet to a String[] and pass it to the > presentation tier. The problem was that the ResultSet couldn't fit in memory so it had to be displayed as it was read. Storing in a String[] is no better than using DTOs in this situation. David > > Mark > > -Original Message- > From: David Graham [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 12, 2003 12:43 PM > > You can't store a ResultSet in an HttpSession because it's not > Serializable. > If you can't fit the result into memory, I would create an Iterator > implementation that loops over a ResultSet and pass that to the > presentation > tier (Servlet or JSP) for rendering. That way you isolate the data > retrieval details (ie. ResultSet) from the next layer. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
Hi, u can think of using cachedrowset, it is similar to resultset but it caches the data what i have done is the following, i run a SQl querry get the resultset and then using this resultset populat a cachedrowset and pass it to jsp ( presentation layer) and then i can use cursor to scroll in cachedrowset i guess u can get more info about cachedrowset n google and if u want how to do scrolling in jsp using cachedrowset http://kulkarni_ash.tripod.com/howto/jsptaglib-howto.html Ashish --- Pat Quinn <[EMAIL PROTECTED]> wrote: > > I have a requirement to cater for a large number of > results returned to the > presentation tier. I've taken a quick look into the > Value List Handler > Design pattern > (http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html). > > I do agree it offers some advantages but in my > opinion it doesn't satisfy > its goal. From the sample code it appears that the > SQL Resultset is > completely loaded and represented as a list of > Transfer Objects. When > dealing with a large result this will have a > negative impact on performance > as it must create a TO for each record. > > I could make some changes to increase performance > i.e. > > Store the ResulSet as a member of the > ValueListHandler Object and only load > the data from the resultset as and when i need it. > If i store the > ValueListHandler in HttpSession i got to ensure i > close all connections > before disposing of it, other wise i could max out > on cursors. > > > Anyone got any ideas/suggestion as to how best to > implement such > functionality? > > _ > The new MSN 8: smart spam protection and 2 months > FREE* > http://join.msn.com/?page=features/junkmail > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
if you are using oracle database , you can try such kind of query to get pages ordered based on some fields select t.* from (select ordered_e.*,rownum as rowno from ( select e.* from employee e order by name ) ordered_e ) t where t.rowno between :b1 and :b2 -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 8:02 PM To: Struts Users Mailing List Subject: RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern --- Mark Galbreath <[EMAIL PROTECTED]> wrote: > I send elements of the ResultSet to a String[] and pass it to the > presentation tier. The problem was that the ResultSet couldn't fit in memory so it had to be displayed as it was read. Storing in a String[] is no better than using DTOs in this situation. David > > Mark > > -Original Message- > From: David Graham [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 12, 2003 12:43 PM > > You can't store a ResultSet in an HttpSession because it's not > Serializable. > If you can't fit the result into memory, I would create an Iterator > implementation that loops over a ResultSet and pass that to the > presentation > tier (Servlet or JSP) for rendering. That way you isolate the data > retrieval details (ie. ResultSet) from the next layer. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
> Some databases let you specify a LIMIT clause, which limits > the results > to whatever you specify, and an OFFSET clause, which starts > the results > at the indicated offset. Using these you can achieve an > elegant subset > of results based on start and end position (and it is IMHO > the best way > to implement the kind of feature you're describing). The disadvantage of this approach is that you'll be tieing your implementation to a specific db vendor at that point. DB vendors implement such functionality differently, from what I've seen. I've yet to see an application that does NOT target a specific db though. YMMV. -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Rendering Large ResultSet - Value List Handler Design Pattern
I have a requirement to cater for a large number of results returned to the presentation tier. I've taken a quick look into the Value List Handler Design pattern (http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html). I do agree it offers some advantages but in my opinion it doesn't satisfy its goal. From the sample code it appears that the SQL Resultset is completely loaded and represented as a list of Transfer Objects. When dealing with a large result this will have a negative impact on performance as it must create a TO for each record. I could make some changes to increase performance i.e. Store the ResulSet as a member of the ValueListHandler Object and only load the data from the resultset as and when i need it. If i store the ValueListHandler in HttpSession i got to ensure i close all connections before disposing of it, other wise i could max out on cursors. Anyone got any ideas/suggestion as to how best to implement such functionality? _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern
where do you keep the initial resultset? Or do you execute the query each time the user requests to page? What would be nice if i could execute an sql statement which would give me a sub set of the results as contolled by a start and end position i specify e.g. Select code, desc from products where ROW_NUM >= 1 and ROW_NUM <= 10 From: "Mark Galbreath" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]> Subject: RE: [OT] Rendering Large ResultSet - Value List Handler Design Pattern Date: Tue, 12 Aug 2003 12:52:13 -0400 I send elements of the ResultSet to a String[] and pass it to the presentation tier. Mark -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 12:43 PM You can't store a ResultSet in an HttpSession because it's not Serializable. If you can't fit the result into memory, I would create an Iterator implementation that loops over a ResultSet and pass that to the presentation tier (Servlet or JSP) for rendering. That way you isolate the data retrieval details (ie. ResultSet) from the next layer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]