The "ValueList Handler" pattern in "Core j2ee patterns(2nd ed)"

In the book "Core j2ee patterns(2nd ed)", it suggests that the "ValueList Handler" pattern can be used when the resultset from database is huge.
Basically, this is what it will do:
1) obtain a resultset from database query
2) cache the full resultset using a valueList
3) create a subList from the valueList
4) present the subList to the front end
To me, caching the full resultset in a valueList is no different from sending the full resultset to the front end. Both of them wasted a lot of resources. I am wondering why anyone would want to do the step(2) above. Why don't we go from (1) to (3) directly since we usually know which subset of the results the users are interested in even before we do the query.

Hi
Same problem I also need to clarify. Please some one
explain in detail which approach give high
performance.
BR
SenakaExactly, I don't understand why that "ValueList Handler" pattern qualified itself as a j2ee pattern since it has so much negative perfomance impacts.
On a website like Amazon, thousands of queries are performed daily. To cache the full resultset of every query simply wouldn't work.
I think the most efficient way is to write a disconnected resultset so it won't tie to the database. The disconnected resultset will only contains those data to be display on the front end.
I would really like to see somthing like the following in the JDBC API.
ResultSet rs = null; // some resultset
ResultSetFilter filter = null;  // a filter to filter resultsets
// obtain a disconnected resultset from java.sql.ResultSet
DisconnectedResultset drs = DisconnectedResultset.filter(rs, filter);
// close the original resultset
rs.close();In the above, anything that meets the condition specified in the filter will be stored in the disconnected resultset. After we created a disconnected resultset, it is safe to close the original resultset to release any database resources.

Similar Messages

  • Welcome to this forum on "Core J2EE Patterns" by the Sun Java Center

    Welcome to this forum on Core J2EE Patterns by the Sun Java Center!
    CONTEXT:
    This forum is intended for discussing the patterns from the Sun Java Center J2EE Pattern Catalog and other topics discussed in our book, Core J2EE Patterns.
    We, the authors of the book, welcome you to this forum.
    WHO WE ARE:
    We are Enterprise Java Architects from the Sun Java Center (SJC), which is the Java consulting organization of Sun Microsystems. We are a world-wide group of architects focusing on all consulting related to Java technologies.
    Visit our web-site for more information on SJC:
    http://www.sun.com/service/sunps/jdc/index.html
    BACKGROUND:
    Over the last few years, we at SJC have worked with our customers in architecting, designing, and implementing solutions on the J2EE platform. We have worked on documenting the J2EE patterns for over two years and released the patterns for public review in Beta form via the Java Developer Connection in May, 2001.
    The beta version of the patterns is available online as The Sun Java Center J2EE Pattern Catalog at:
    http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
    Subsequent to the release, we received great feedback and comments from hundreds of reviewers. We then worked towards incorporating the feedback into the pattern documentation. One of the common comments was about the lack of code examples in the online documentation. The latest pattern documentation provides many code examples and incorporates all the feedback received so far.
    BOOK INFORMATION:
    Core J2EE Patterns, the book, was released at JavaOne 2001 during June 4-9, and will be available in stores around the end of June 2001.
    The book includes the complete updated Sun Java Center J2EE Pattern Catalog with 15 patterns covering these J2EE technologies: Java Server Pages (JSP), Servlets, Enterprise JavaBeans (EJB), and Java Message Service (JMS). In addition to the J2EE Pattern Catalog, the book also provides other chapters that discuss design considerations,
    bad practices, and J2EE Refactorings. Example code is included for all patterns and strategies.
    If you wish to view the complete table of contents or order the book, please visit one of the following online bookstores:
    Fatbrain.com: http://www1.fatbrain.com/asp/bookinfo/bookinfo.asp?theisbn=0130648841
    Amazon.com: http://www.amazon.com/exec/obidos/ASIN/0130648841
    COMMUNITY:
    The online community for discussing the patterns included in our book Core J2EE Patterns has grown over the past year, since our first presentation at JavaOne 2000. This community is supported by our LISTSERV and is available for public participation at:
    http://archives.java.sun.com/j2eepatterns-interest.html
    You can view the past discussions on this list at the above URL.
    FORUM LOGISTICS:
    John and Dan are on the east coast and Deepak is on the west coast. We will be tuned into the forum and answering the messages periodically between June 19 and June 25, 2001. If you want to discuss the J2EE Patterns after June 25, you are invited to join the aforementioned J2EE Patterns Interest list.
    FORUM DISCLAIMER:
    All responses to questions posed in this News Group are given on an "as is" basis. We believe the solutions or explanations given here are correct, but do not guarantee that responses will be complete, without error and/or work for all platforms and system configurations.
    The forum is now open! Let the discussion begin...
    John Crupi - Chief Java Architect
    Dan Malks - Enterprise Java Architect
    Deepak Alur - Enterprise Java Architect
    ---Authors of Core J2EE Patterns

    Rajakannan,
    There are numerous ways to implement a templating mechanism in support of the composite view pattern, included in the catalog as a presentation-tier pattern.
    The goal is to avoid simply having monolithic views with all the formatting code embedded directly withing the view. If we have common subviews that are shared across several or more views then we end up with a copy-and-paste type of reuse...undesirable. So, modularity is one issue. Another major force when considering the Composite View pattern is that we may want to manage the layout of our pages and the content of our pages separately. We may have some logical regions defined, such as a search panel and main body, and a subview that plugs into those logical regions that map to a physical page (ie: x.jsp and y.jsp). We may then want to vary one independent of the other...ie: we may want to modify the layout of the page w/o changing the content and we may want to vary the content w/o touching the layout.
    There are a number of implementation strategies that can be used to implement the Composite View pattern, ranging from relatively simple to much more sophisticated. We describe each in our book and include source code examples.
    The example in the book that allows for supporting all the issues described above is implemented using the "Custom Tag View Management Strategy" and uses a tag library written by David Geary, that supports the Composite View pattern. The library is also included in David's new book, Adv. JavaServer Pages, Prentice Hall, 2001.
    Again, it's simply one implementation and, as you mention, there are many different ways to implement this strategy.
    Thanks for your question,
    Dan

  • Core J2EE Patterns - ActionMap XML

    I am reading through Core J2EE Patterns and I'm confused about a coupel fo thing and hoping someone can shed some light for me.
    1. I'm confused on how to actually implement the Map, refered to on page 208, which hold references to handles that represent target resoruces.
    2. In the example micro-architecture in chapter, page 603, references an XML file called HireEmployeeActionMap.xml. I believe this to be the action mapping file, but it's not clear how it is used. More imortant, the class in example 9.4 simply has a coment that I should "Get real commandstring from mapfile usign Action", while being helpful that it is included, is not so helpful if you don't actually know how to go about reading this XML file.
    More to the point, here is my task:
    I have a servlet (existing code from someone else) that I am going to refactor and make more expandable by implementing some of the J2EE patterns I've been reading about. My understanding of the patterns is varied, of course.
    This servlet does one basic thing. It accepts an HTTP transaction from an app that sends it request parameters (liek a form) to perform a specific transaction, of which there are about 12. Each transaction requests a different task to be peformed, of course. Speifically, data lookups in a various enterprise system or placing requests into various system queuss and such.
    Right now this sevlet has a huge if/else block checking for each transaction ID sent in the parameters and then calls a method to handle that transaction (calling delegates, facades, and services in the down path).
    I'd like to refactor this so that I have an CommandMapper that uses an CommandMap to map out each transaction ID to an Command class specific to that transaction. This way, I can write the application controller once and then when new transactions are needed, I simply add the new comand to the CommandMap XML file and add the new Command class (and delegates, facades, ejbs, etc.) and I'm done. No regression testing on the other transactions because there was no core code modified.
    So I went looking for exmaples of how to implement CommandFactory and CommandMap and I'm stumped. I also can't find any good examples of reading an XML file for this purpose. Any help would be greatyl appreciated.

    One more thought: my questions above have nothing to do with the classes and interfaces found in javax.activation. I'm going from the book mentioned above.

  • Question of using Struts for the J2EE pattern

    I am now using Struts for the development. I have 3 questions about J2EE
    pattern by the use of Struts:
    1) How can I use Struts to create the Front Controller? In the book
    descibing Front Controller, it is a servlet file which receives the request
    and then dispatches to the appropriate view according to the request.
    However, in using Struts, should I use the same way? However, I found that
    in using Struts, I can call the controller class which subclass
    ActionServlet, all the views forwarded are declared in the
    struts-config.xml. Am I right in this method?
    2) In the project, there is a Front Controller which dispatches the request
    to the appropriate view (jsp file). Of course, I use Struts to do this.
    However, I expect that the user is impossible for going to the view (jsp
    page) directly by typing the address of the jsp file. I hope that the user
    can go to the view through the controller only. How can I do this?
    3) There is a problem by using browser - when a user browses a site, he can
    press the 'back' button to the previous page, and then click the 'forward'
    button also. How can I prevent this by using Struts? I found that in some
    sites, when the user clicks the 'back' button, an error page displays. How
    can I do this? Thanks!
    Many Thanks!
    Stephen

    I'll take a stab at number 2 and number 3.......
    2) You could have the controller object place a "flag" in the request that is dispatched to the JSP. Make the JSP check for that flag to ensure that this request came from the controller object. If the request comes from anywhere other than the controlle object, you can display an error page, or you could redirect them back to the controller. You could also use the HTTPSessionObject to place flags for users and have the JSP check there.
    3) Keep a log of the user's activities in the HTTPSession. Whenever a page is invoked, have it check to see if the user has already been here, and if it is appropriate for the user to be here again.
    Hope this helps!!
    I'm not really a java programmer, I just play one on TV.

  • Cor design pattern

    I use cor design pattern little different than what I see in google.
    here is m y cor
         public static  abstract  class CORHandler    {
              CORHandler  nextHandler;
              public void process(){
                   if(canHandleRequest()){
                        handleRequest();
                   }else {
                        if(nextHandler!=null) nextHandler.process();
              protected abstract  boolean canHandleRequest();
              protected abstract void  handleRequest();
              public void setNextHandler(CORHandler  corHandler){
                   nextHandler=corHandler;
         }this serves most of my need and also I can override process method for change behaviour .
    this code helps me save lots of if/else conditions , I am not passing any object to the method here reason is I use this always as inner class inside a method so I can access all final fields
    advice me is this right when applying cor pattern?

    Making it a base class increases connectivity to no good purpose.
    It violates the concept of inheritance by making the objects COR classes which is not what they are.
    It violates the principal of COR in that the intent is to handle a responsibility not all responsibilities. This same problem obscures the pattern as well by eliminating the objects to be acted upon.

  • Patterns used in J2EE Blueprints

    Does it specify anywhere exactly what patterns are used in the Blueprints and what components/beans/classes map to each pattern ?
    Thanks very much
    P.

    Go to http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ and click on J2EE Patterns Catalog for a better explanation of the patterns and how/when to use them. These are based on the book Core J2EE pattrens- Best practices and design strategies. You can download example source code from http://www.phptr.com/corej2eepatterns/

  • How to design using J2EE pattern?

    I am new to J2EE and I would like some ideas on how I should design the following system in J2EE pattern. I am required to use JSP pages + EJB to implement a very simple online shopping system. And I already created the following classes:
    This is the EJB object interface.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    import java.util.Vector;
    public interface ShoppingSystem extends EJBObject {
         public boolean LoginAsCust(String id,String pwd) throws RemoteException;
         public boolean LoginAsAdmin(String id,String pwd) throws RemoteException;
         public Vector getMusicCategories() throws RemoteException;
         public Vector getCategoryItems(String category) throws RemoteException;
         public MusicRecording getMusicRecording(String id) throws RemoteException;
    }This is the home interface.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    public interface ShoppingSystemHome extends EJBHome {
         public ShoppingSystemHome create() throws RemoteException, CreateException;
    }This is the session bean objects.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    import java.util.Vector;
    public class ShoppingSystemBean implements SessionBean {
         // data item to hold a reference to a passed Session context
         private SessionContext ctx;
         // save the session context
         public void setSessionContext(SessionContext x) { ctx = x;}
         // the various method implementations
         // imposed on us by interface
         public void ejbCreate() {}
         public void ejbActivate() {}
         public void ejbPassivate() {}
         public void ejbRemove() {}
         public boolean LoginAsCust(String id,String pwd) throws RemoteException{
         public boolean LoginAsAdmin(String id,String pwd) throws RemoteException{
         public Vector getMusicCategories() throws RemoteException{
         public Vector getCategoryItems(String category) throws RemoteException{
    public MusicRecording getMusicRecording(String id) throws RemoteException{
    }I will probably need to create a shopping cart class and a database accessor class. What I would like to know is , do I need to divide the shopping cart class into three components: Home interface, EJB object interface, SessionBean object.
    Please give me some ideas on how I can develop this system using EJB. (This is just a school assignment)
    Thanks.

    know is , do I need to divide the shopping cart class
    into three components: Home interface, EJB object
    interface, SessionBean object.Shopping cart is a typical example of a stateful session bean. So you need to write a session bean. And, of course, every session bean consists of three things: remote interface, home interface and bean class.
    Please give me some ideas on how I can develop this
    system using EJB. (This is just a school assignment)In this case you can tell them to fuk off.

  • J2ee patterns

    Hi, anyone can tell me wich j2ee patterns are really necessary to learn, I'm asking so coz there many patterns already implemented in many framework. which of those should I learn for my future applications, thanx...

    ramesh_bhojan wrote:
    Well, all the design patterns are unique and may have their own advantages.....
    However, as a beginner u may concentrate on Singleton pattern(which is actually a creational pattern) and the Factory Pattern.(The Factory Class)...
    going forward.... u may learn bout the other design patterns available... as all of them are interesting in some way or other...Singleton has been largely discredited:
    http://code.google.com/p/google-singleton-detector/
    %

  • [svn:bz-trunk] 20506: Bug fix BLZ-622 enhance the ClassDeserializationValidator to have default allow class patterns

    Revision: 20506
    Revision: 20506
    Author:   [email protected]
    Date:     2011-03-01 10:33:24 -0800 (Tue, 01 Mar 2011)
    Log Message:
    Bug fix BLZ-622 enhance the ClassDeserializationValidator to have default allow class patterns
    So we don't need to configuration for the common allow classes
    Checkintests pass
    Ticket Links:
        http://bugs.adobe.com/jira/browse/BLZ-622
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/validators/ClassDeserializationValidator.ja va

  • Changing pie chart to 3D pie causes it to lose the master page scheme and become rock patterns instead.

    When I change my Keynote pie chart to a 3D pie chart it loses the master page color scheme, becoming rock patterns instead. I haven't been able to get it to return to the original color scheme.

    Thanks for the response.
    On the first issue, unfortunately formatting the legend using that technique results in no change to the legend. The only way I was able to get it to resize was by resizing the entire chart area.
    On the second point, I must be missing something. Do you mean that there is no way to format a chart such that all slices have the desired formatting at runtime unless the report is always run with the same parameters? I might as well just draw a static picture :/

  • Where is the exception stacktrace - weblogic.webservice.core.handler.Invoke

    Hi, I am debugging a Web Service. It sometimes throws an exception while deserializing the input. But when I look through the log all I see is:
    ####<Jul 27, 2010 9:20:43 AM EDT> <Info> <WebService> <myhost.net> <prodServer114> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1280236843573> <BEA-220024> <Handler weblogic.webservice.core.handler.InvokeHandler threw an exception from its handleRequest method. The exception was:
    java.lang.NumberFormatException: For input string: "".>
    How do I make weblogic spit out the exception stacktrace?
    I am using Weblogic 9.2.
    Thanks in advance!

    Hi, I am debugging a Web Service. It sometimes throws an exception while deserializing the input. But when I look through the log all I see is:
    ####<Jul 27, 2010 9:20:43 AM EDT> <Info> <WebService> <myhost.net> <prodServer114> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1280236843573> <BEA-220024> <Handler weblogic.webservice.core.handler.InvokeHandler threw an exception from its handleRequest method. The exception was:
    java.lang.NumberFormatException: For input string: "".>
    How do I make weblogic spit out the exception stacktrace?
    I am using Weblogic 9.2.
    Thanks in advance!

  • Where is the stack trace weblogic.webservice.core.handler.InvokeHandler

    Hi, I am debugging a Web Service. It sometimes throws an exception while deserializing the input. But when I look through the log all I see is:
    ####<Jul 27, 2010 9:20:43 AM EDT> <Info> <WebService> <myhost.net> <prodServer114> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <1280236843573> <BEA-220024> <Handler weblogic.webservice.core.handler.InvokeHandler threw an exception from its handleRequest method. The exception was:
    java.lang.NumberFormatException: For input string: "".>
    How do I make weblogic spit out the exception stacktrace?
    I am using Weblogic 9.2.
    Thanks in advance!

    Hi, I am debugging a Web Service. It sometimes throws an exception while deserializing the input. But when I look through the log all I see is:
    ####<Jul 27, 2010 9:20:43 AM EDT> <Info> <WebService> <myhost.net> <prodServer114> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <1280236843573> <BEA-220024> <Handler weblogic.webservice.core.handler.InvokeHandler threw an exception from its handleRequest method. The exception was:
    java.lang.NumberFormatException: For input string: "".>
    How do I make weblogic spit out the exception stacktrace?
    I am using Weblogic 9.2.
    Thanks in advance!

  • Could not open the editor: Illegal hex characters in escape (%) pattern...

    I have another problem for migrating from Eclipse/Tomcat to Oracle Enterprise Pack for Eclipse/WebLogic. I got a message for a file "header.jsp":
    "Could not open the editor: URLDecoder: Illegal hex in escape (%) pattern - For Input String: " =".
    The error is for :
    <img id="EFLogo" src="<%=EFLib.Pub.Logo %>" />      Where "EFLib.Pub.Logo is a public static variable.
    The project works in Eclipse/Tomcat. It is also work for WebLogic. The problem is I cannot open and edit the file "header.jsp" and some other files with similar scriplets. What is wrong?
    Please help.
    Jerry
    Edited by: 883301 on Sep 5, 2011 6:45 AM

    Hi Jerry,
    Looks like you've hit a bug in the code for the Web Page Editor (WPE) in the JSF Tools project of WTP. The design view of the WPE fails with an IllegalArgumentException in a call to the URLDecoder. I've filed a bug at Eclipse. See...
    http://forums.oracle.com/forums/thread.jspa?forumID=578&threadID=2278517
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=356841
    To work around this until the issue is fixed, you could open this file with the "JSP Editor" - just use the "Open With" context menu option.
    Carlin
    Edited by: crogers on Sep 6, 2011 11:44 AM

  • When I connect my Air to my Samsung TV, I am able to see the screen mirrored on the tv for a split second before the tv turns to static.  This pattern then cycles over and over.  I can't get the image to stay on the tv screen.  Any ideas?

    When I connect my Air to my Samsung TV, I am able to see the screen mirrored on the tv for a split second before the tv turns to static.  This pattern then cycles over and over.  I can't get the image to stay on the tv screen.  Any ideas?

    Try:
    - Going to NF support site/contacting them
    - Try a different adopter
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                             
    - Restore to factory settings/new iOS device.

  • How does the JVM handle private class parameters in a utility class?

    If I have a class that is public and not labeled as static, but it's constructor is private so that it cannot be instantiated, and all of its parameters and methods are both private and static. The methods modify the private parameters. In this case, the code explicitly is avoiding a singleton pattern, so there isn't even a class being instantiated, so this is a true utility class.
    However, the static methods are accessible from multiple objects, and as far as I can tell, the JVM is persisting the parameters in memory beyond the specific thread that called the static method to begin with.
    The question I have is how the JVM handles this? Are these private parameters assigned memory and are indeed persisted independent of thread, since there is no class reference. I am working with byte code injection, and the assumption is that a direct reference to a static parameter is much faster to call than having to go through an object reference. Of course, from a programmer point of view, I much prefer the singleton pattern since I am so used to hang my hat on a class reference.
    Thanks.

    entguru wrote:
    However, the static methods are accessible from multiple objects...Not if the methods are private, as you seemed to indicate ("all of its parameters and methods are both private and static").
    Are these private parameters assigned memory and are indeed persisted independent of thread, since there is no class reference. There is a class reference. It refers to the class, and is obtainable via the class literal; e.g., MyClass.class.
    ~

Maybe you are looking for

  • Change name in "Connected as:" line

    Hello; I have changed my name and username on my system; however, when connecting to the TC, its Finder winnow still showing "Connected as: {my old name}". I have tried to restart Finder, the computer, and TC itself with no luck. It is not serious, I

  • Using gradients with the gradient mesh tool

    So I have a basic knowledge of using the gradient mesh tool, but in my current project I need the gradients within the object to fade from black to transparent (it will be used for a one-color tshirt).  I've tried to do this a couple different ways. 

  • SROAUG meeting invite-Friday June 21, 2002

    SROAUG Meeting Invite-Friday, June 21,2002 Please attend the SROAUG (Southwest Oracle Applications Users Group) upcoming meeting: Location: Sheraton Gateway Hotel at LAX (Los Angeles International Airport) Time: 8:30 am to 12:30 pm General Presentati

  • CLD Sample Exams: How to deal with references ?

    Hi@all: I reviewed  the sample exams solution for the CLD provided by NI and noticed, that they trifle with references. As shown in the Security System and the ATM Machine, references were opened, but not closed at the end. What do you think, will th

  • Iphone 3GS 3.1.2 Battery drain problem

    Hi, Recently i have purchased Iphone 3gs with software 3.1.2. I'm facing a serious problem of battery drain. Without doing anything, the battery drains so fast. Is there is any way to over come this problem?