How to retrieve content from DAO Class and process in Controller Class?

Hello
This is for the experts.
What is the best approach to passing a large set of data from Class A to Class B? I have a DAO Class that connects to a database to retrieve data. I tried saving the data in a collection (map) and passing the collection to Class B. The problem here is that the data is may be too large for a collection without increasing the heap size, it could cause out of memory exception. Instead I'd like to pass the data (row by row) on to the "Controller" Class where which will process each row. I am not sure how to do this without using a collection or some sort. Some tips will be much appreciated.
Note: MVC Rules dictates that Controller cannot call the DAO Class directly, it has to go through the Model which talks directly with the DAO Class.
Thanks
Edited by: 875864 on 30-Oct-2011 15:05

875864 wrote:
Hello
This is for the experts.
What is the best approach to passing a large set of data from Class A to Class B? I have a DAO Class that connects to a database to retrieve data. I tried saving the data in a collection (map) and passing the collection to Class B. The problem here is that the data is may be too large for a collection without increasing the heap size, it could cause out of memory exception. Instead I'd like to pass the data (row by row) on to the "Controller" Class where which will process each row. I am not sure how to do this without using a collection or some sort. Some tips will be much appreciated.
Note: MVC Rules dictates that Controller cannot call the DAO Class directly, it has to go through the Model which talks directly with the DAO Class.
Thanks
Edited by: 875864 on 30-Oct-2011 15:05if its a large set of data, and is fetched from DB and you are sure that it is too large and chances of getting out of memory exception then why you are passing it over request.
If the data is fetched based on some filter criteria, then just pass the filter criteria from class A to class B, and fetch the data from DB based on the filter criteria in class B.

Similar Messages

  • How to retrieve data from catsdb table and convert into xml using BAPI

    How to retrieve data from catsdb table and convert into xml using BAPI
    Points will be rewarded,
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi,
    This is not your requirment but u can try this :
    CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
    GRANT READ ON DIRECTORY text_file TO fah;
    GRANT WRITE ON DIRECTORY text_file TO fah;
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    CREATE TABLE A AS select * from load_a;
    SELECT * FROM A
    Regards
    Faheem Latif

  • How to retrieve records from a database and display it in a jsp page.Help!!

    Hello everyone ! im very new to this forum.Please help me to solve my problem
    First i ll explain what is my requirement or needed.
    Actually in my web page i have text box to enter start date and end date
    and one list box to select the month .If user select or enter the dates in text box
    accordingly the data from ms access database has to display in a jsp page.
    Im using jsp and beans.
    I tried returning ResultSet from bean but i get nothing display in my web page
    instead it goes to error page (ErrorPage.jsp) which i handle in the jsp.
    I tried many things but nothing work out please help me to attain a perfect
    solution. I tried with my bean individually to check whether the result set has
    values but i got NullPointerException . But the values which i passed or
    available in the database.
    I dint get any reply for my last post please reply atleast to this.
    i get the date in the jsp page is by this way
    int Year=Integer.parseInt(request.getParameter("year"));
    int Month=Integer.parseInt(request.getParameter("month"));
    int Day=Integer.parseInt(request.getParameter("day"));
    String startdate=Day+"/"+Month+"/"+Year;
    int Year1=Integer.parseInt(request.getParameter("year1"));
    int Month1=Integer.parseInt(request.getParameter("month1"));
    int Day1=Integer.parseInt(request.getParameter("day1"));
    String enddate=Day1+"/"+Month1+"/"+Year1;But this to check my bean whether it return any result!
    public void databaseConnection(String MTName,String startDate,String endDate)
    try
             java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
            java.sql.Date sqlFromDate=new java.sql.Date(fromDate.getTime());
            java.sql.Date sqlTillDate=new java.sql.Date(tillDate.getTime());
              String query1="select MTName,Date,MTLineCount from Main where MTName='"+MTName+"'  and Date between '"+sqlFromDate+"' and '"+sqlTillDate+"' " ;
            System.out.println(query1);
              Class.forName(driver);
             DriverManager.getConnection(url);
             preparedStatement=connection.prepareStatement(query1);
             preparedStatement.setString(1,"MTName");
              preparedStatement.setDate(2,sqlFromDate);
              preparedStatement.setDate(3,sqlTillDate);
              resultSet=preparedStatement.executeQuery();           
               while(resultSet.next())
                        System.out.println(resultSet.getString(1));
                        System.out.println(resultSet.getDate(2));
                        System.out.println(resultSet.getInt(3));
            catch (Exception e)
             e.printStackTrace();
    I Passed value from my main method is like thisl
    databaseConnection("prasu","1/12/2005","31/12/2005");Please provide solutions or provide some sample codes!
    Help!
    Thanks in advance for replies

    Thanks for ur reply Mr.Rajasekhar
    I tried as u said,
    i tried without converting to sql date ,but still i din't get any results
    java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
              String query1="select MTName,Date,MTLineCount from linecountdetails where mtname='"+MTName+"'  and Date >='"+fromDate+"' and Date <='"+tillDate+"' " ;
            System.out.println(query1);
    //From main method
    databaseConnection("prasu","1/12/2005","31/12/2005");I got the output as
    ---------- java ----------
    select MTName,Date,MTLineCount from linecountdetails where mtname='prasu'  and Date >='Thu Dec 01 00:00:00 GMT+05:30 2005' and Date <='Sat Dec 31 00:00:00 GMT+05:30 2005'
    java.lang.NullPointerException
    null
    null
    java.lang.NullPointerException
    Output completed (4 sec consumed) - Normal TerminationThanks
    Prasanna.B

  • How to show content from microsoft word and pdf on a page

    Hi,
    I have a microsoft word file stored in content repository and I want to show it in web page. When I drag and drop it using content presenter it shows file as a link with some extra details like created by, last modified by etc. I want content to appear in UI page itself. Content of document should get converted to html at runtime and then appear in UI. Is it possible?
    Thanks
    Sanjeev

    Sanjeev,
    I see you have as similar requirement you posted in the thread here :
    Skipping ucm login form when showing content on webcenter application.
    InBound Refinery (IBR) would be the easiest way to accomplish this though.
    Once you have IBR installed and configured (you need to pick what formats need to be converted in the refinery, and in your case, choose MS Office formats),
    You can use the document viewer taskflow to render PDF versions of your Word/Excel or PDF documents on a webcenter page. There is little to no setup required for this, beyond configuring IBR (but configuring IBR is fairly involved) and selecting what MIME types you want IBR to process.
    Another thing to watch out for if you are using Spaces is, make sure you set the context root for UCM properly though EnterpriseManger.
    Dynamic Converter can also be used to get similar results. You mention that you are using an Iframe, that means the client is making a request to UCM directly, and to avoid re-authenticating there, you should have SSO enabled. With Dynamic converter, you can use a URL of the form :
    http:// +<host>:<port>+ / +<context_root>+ /idcplg?IdcService=GET_DYNAMIC_CONVERSION&dDocName= +<docID>+ &RevisionSelectionMethod=LatestReleased
    To get an HTML rendition of that document.
    Hope it helps !
    -Jeevan
    Edited by: Jeevan Joseph on May 14, 2012 3:07 PM
    Edited by: Jeevan Joseph on May 14, 2012 3:08 PM

  • How to modify select query for retrieve assets from assets tab and assets in merchandising in 10.1.2?

    Hi All,
          I need to modify the SQL for retrieving assets from assets tab and assets in merchandising in 10.1.2. I found the class for SQLQuery builder, but I want to change the SQL.
          Could you anyone please how to solve this.
    Thanks & Regards,
    Bala

    Hi All,
          I need to modify the SQL for retrieving assets from assets tab and assets in merchandising in 10.1.2. I found the class for SQLQuery builder, but I want to change the SQL.
          Could you anyone please how to solve this.
    Thanks & Regards,
    Bala

  • HT4527 How can move the apps and playlists on my iPad to my Mac? Whenever I attempt to sync, I get a message stating that all apps and music on my iPad will be replaced by content from my Mac and there are no content. Thanks.

    How can move the apps and playlists on my iPad to my Mac? Whenever I attempt to sync, I get a message stating that all apps and music on my iPad will be replaced by content from my Mac and there are no content. Thanks.

    the apps will not be deleted if the itunes is authorised for the apple id from which you downloaded the apps.
    for the songs if you have downloaded it from a store other than itunes an app "TuneAid" will help you. download the full version then you can copy all the songs on the ipad to ur itunes library

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • How to retrieve photos from the iCloud

    How to retrieve photos from the iCloud

    icloud only stores photos in backups (or in a special case, when using photo stream).  If you have turned on backup and made sure the camera roll is turned on (only photos from camera roll are backed up), then you can get photos back by performing a restore.  But note that users should always sync photos to a computer to archive them, relying on icloud is not foolproof.
    http://support.apple.com/kb/HT1766?viewlocale=en_US&locale=en_UShttp://www.ipadconverter-mac.com/restore-iphone-from-icloud/
    Go to Settings>General>Reset and tap Erase All Content and Settings.  This will erase your device.  Then you will go through the setup screens again as you did when your device was new, and when given the option, select Restore from iCloud Backup.

  • How to parse contents from XML file in Java

    Hi All,
    I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
    How to parse Contents of XML file??
    Thanks in advance,
    Rajendra.

    Hi All,
    I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
    How to parse Contents of XML file??
    Thanks in advance,
    Rajendra.

  • How to fetch content from UCM in WLP using VCR

    Hi,
    I configured the connection between weblogic portal v10.3.2 and UCM 11g using VCR adapter guide. But i am struck in how to fetch the content from UCM/VCR and display it in Weblogic portal.
    Please guide me on how to fetch the content from UCM/VCR and display it in Weblogic Portlet ( JSF Portlet). is there any api is available to get the content from ucm and display it in portlet.
    Appreciate your support here.
    Thanks a lot,
    Suresh

    Suresh,
    Please check the name of the VCR configured in the UCm.
    You can use a batch file to load the VCR on to your Weblogic server. Using the name you can retrieve the contents from UCM.
    Please let us know other configuration details to help you further

  • How to retrieve data from MDM using java API

    hi experts
    Please explain me the step by step procedure
    how to retrieve data from MDM using java API
    and please tell me what are the
    important classes and packages in MDM Java API
    thanks
    ramu

    Hi Ramchandra,
    You can refer to following links
    MDM Java API-pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2d18d355-0601-0010-fdbb-d8b143420f49
    webinr of java API
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/89243c32-0601-0010-559d-80d5b0884d67
    Following Fourm Threads will also help.
    Java API
    Java API
    Re: usage of  java API ,
    Matching Record
    Need Java API for Matching Record
    Thanks and Regards,
    Shruti.
    Edited by: Shruti Shah on Jul 16, 2008 12:35 PM

  • How to receive parameters from a form and insert values in db using servlet

    Hi friends,
    My first question here.
    I'm trying to create a Servlet that takes input from a form and process it and insert it in database.tablename.
    My MAIN ISSUE IS WITH THE NUMBER OF COLUMNS THAT WOULD BE DYNAMIC AND THUS CANT RECEIVE THE PARAMETERS IN STATIC CODE.
    Here is the form code
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <form action="Test" method="post" />
    <table width="90%" border="1" cellspacing="1" cellpadding="1">
    <tr>
    <th scope="col">Student Name</th>
    <th scope="col">RollNo</th>
    <th scope="col">Java</th>
    <th scope="col">J2ee</th>
    </tr>
    <tr>
    <td><input type="text" name="studentname" /></td>
    <td><input type="text" name="rollno" /></td>
    <td><input type="text" name="java" /></td>
    <td><input type="text" name="j2ee" /></td>
    </tr>
    <tr>
    <td><input type="text" name="studentname" /></td>
    <td><input type="text" name="rollno" /></td>
    <td><input type="text" name="java" /></td>
    <td><input type="text" name="j2ee" /></td>
    </tr>
    <tr>
    <td><input type="text" name="studentname" /></td>
    <td><input type="text" name="rollno" /></td>
    <td><input type="text" name="java" /></td>
    <td><input type="text" name="j2ee" /></td>
    </tr>
    </table>
    <input type ="submit" value="insert values in the database now"/>
    </form>
    </html>
    And here is the Servlet
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    public class Test extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Module: Process Result Values from previous page";
    out.println("<html>\n" +
    "<head><title>" + title + "</title></head>\n" +
    "<body>");
              try
                   Class.forName("com.mysql.jdbc.Driver");
                   Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/","root", "root");
                   Statement s = con.createStatement();
    ResultSet res = s.executeQuery("SELECT * FROM dbname.tablename");
    ResultSetMetaData rmeta=res.getMetaData();
    int noofcolumns=rmeta.getColumnCount();
                   if(!con.isClosed())
              catch(Exception e)
    System.out.println("Exception"+e);
    out.println(e);
    if(connectionFlag==1)
    out.println("</body></html>");
    doGet(request, response);
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    This is the basic code structure and I'm trying to figure out this special case with handling the multiple parameters:
    1. I dont' want to use String []a=request.getParameterValues("studentname"); as hard code. The reason being the number of rows will be diyamic and I would like to get the column name and then then use an array of string to take values. But how can I connect these to form a query so that the rows goes on inserted one after other.
    Thanks,
    Mashall

    Thank you for your help.
    I'm something close to it but this segment of code throws a NullPointerException Error. I counted number of rows and columns using the methods getColumnCount() and getColumnName(i).
    ResultSetMetaData md = res.getMetaData(); //Get meta data for the resultset
    int noofcolumns=md.getColumnCount();
    out.println("<br />Number of columns in table (including name and roll number) :::: "+noofcolumns+"<br />");
    for(int i=1;i<=noofcolumns;i++) // access column 1....n
    String columnname = md.getColumnName(i); // get name of column 1....n
    out.println("<br />Current column name ::: "+columnname+"<br />"); //check if the name appear correct.
    String []columndata = request.getParameterValues(columnname); //Get raw value in array
    for(int j=1;j<=rows;j++) // here rows is number of rows in each column
    out.println("To be inserted: <b>"+columndata[j]+"</b> in Row ::: "+j+"<br />");
    //The line above thows null pointer exception.
    }

  • HT201269 how to transfer content from an android Galaxy phone to an iPhone5s?

    How to transfer content from a Galaxy II Android phone to a iPhone5s?

    Alternatively, you can copy photos from Android phone to wireless flash drive and from wireless flash drive to iPad.
    http://www.sandisk.com/products/wireless/flash-drive/

  • How to retrieve info from a MacOs Standard floppy?

    How can I retrieve information from a MacOs Standard formatted floppy disk on Snow Lion?
    I have this collection of old floppy disks that were formatted as MacOs Standard format back in the days. They do hold some files which I'd like to backup on a backup drive.
    But, Snow Lion does not read MacOs Standard formatted disks apparently.
    So, does anyone know how to retrieve information from MacOs Standard formatted floppy disks?
    Thank you!

    This what I see in ML with my old SmartDisk VST (model# FDUSB-M) floppy drive:
    Interesting observations:
    1. I was able to add and remove files to the disk.
    2. I was not able to erase the disk with Disk Utility. It returned an error.
    3. Disk Utility did not offer the HFS+ format option, only FAT32 and ExFAT.
    4. I could only find 1 floppy in my house so it could be partially defective.

  • How to migrate content from BW 3.1 to NetWeaver 7.0

    Hello all out there,
    For a couple of years I have been successfully using SDN, finding always the right answer to my questions, however in my late assignment things have not been running that smoothly.
    This is my first posting to SDN and I hope any of you out there can give me a hand.
    <b>My Case:</b>
    We are planning to upgrade from BW 3.1 directly into NetWeaver 7.0
    <b>Our previous research within our planning phase has taking us to read:</b>
    •Everything under the Marketplace NetWeaver Upgrade portal (https://websmp204.sap-ag.de/upgradenw70)
    •Upgrade Master Guide
    •Many docs in SDN
    <b>My Question:</b>
    Based on our research, we have a good understanding about the technical upgrade path and the creation of a new landscape. However anything we have read explains about how to migrate our actual Queries, ODS, Web Templates, Infocubes, Update Rules, InfoObjects, etc to the new environment.
    <b>Could you please point me to the right literature, how to guide, migration path, etc; explaining how to migration content from BW 3.1 to NetWeaver 7.0</b>
    Thanks
    Alejandro

    Hi,
    This is more a question for the BI forums.
    Anyway, have a look at
    service.sap.com/upgrade-bw
    BW3.0B upgrade to BI 7.0 question about BI Content 3.1
    /thread/367125 [original link is broken]
    /thread/150068 [original link is broken]
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/2e8e5288-0b01-0010-2ea8-bcd4df5084a7
    Eddy
    PS. Which type of SDN Ubergeek/BPX suit are <a href="/people/eddy.declercq/blog/2007/05/14/which-type-of-sdn-ubergeekbpx-suit-are-you">you</a>?
    Deadline: June 15th

Maybe you are looking for

  • Problem while displaying Purchase order using me9f

    Hi All, I have copied ME9F as ZME9F, and SAPFM06P as ZSAPFM06P (print program of purchase order). Now when I display the PO using ME23n, there is no problem and PO is getting displayed absolutely fine. But When I display the same PO using ZME9F, the

  • Quicktime Export 1920 x 1080

    Hi Using CS5 Master Collection. I am giving my finished output to someone who is doing color correction for me.  The source is 1920 x 1080, (1.9), 29.97 fps Progressive. They want a quicktime format.  Not an AVI. I am looking at the Export Settings f

  • Some charges apply even when i have world unlimite...

    I have the trial of the pack world unlimited but have some charges discounting from my credit when i call a mobile phone in Argentina. Is the pack not working well? Please give me some support in the page there are no option for support, only this co

  • Powerbook 1400cs convert appleworks 5 to anything

    Can anyone help me out? I have a Appleworks 5 databases and want to convert to them to anything else, for example: PC access . My Powerbook is NOt connected to Internet and has only floppies. Thanks, maria

  • How to disable a Firefox Add-ons QuickFox Notes

    How to disable a QuickFox Notes