How to create a constructor dynamically

Hi ,
I want to create a constructor dynamically.
I have a bean class with 30 fields.
In my application I want to use this bean objects to hold the data returned from a ResultSet.
But the problem is I have dynamic columns returned by the ResultSet. some times it gives 10 & some times it will be 20.
I want to create a constructor on the fly with these dynamic columns.
Is it possible with the reflection API ? if possible, please give me sample code or link.
thanks
bhuvan

One way I have implemented a solution for this issue is creating a 'TransferEntity' that contains the generic values (in an array usually). Then you can wrapper this class with a "friendlier" one that has Get/Set methods. This allows you to always get the values you need (because the TransferEntity is inside) if they are variable. If not variable, you can simply use the Get/Set (which would reach inside the TransferEntity). Depending on how you're using the bean, you can simply put all the Get/Set methods inside and either return null, throw a NoSuchFieldException, etc.
Hope this helps...
Edited by: dfortae on Apr 29, 2010 2:44 AM

Similar Messages

  • How to create  some columns dynamically in the report designer depending upon the input selection

    Post Author: ekta
    CA Forum: Crystal Reports
    how  to create  some columns dynamically in the report designer depending upon the input selection 
    how  export  this dynamic  report in (pdf , xls,doc and rtf format)
    report format is as below:
    Element Codes
    1
    16
    14
    11
    19
    10
    2
    3
    Employee nos.
    Employee Name
    Normal
    RDO
    WC
    Breveavement
    LWOP
    Sick
    Carers leave
    AL
    O/T 1.5
    O/T 2.0
    Total Hours
    000004
    PHAN , Hanh Huynh
    68.40
    7.60
    76.00
    000010
    I , Jungue
    68.40
    7.60
    2.00
    5.00
    76.00
    000022
    GARFINKEL , Hersch
    66.30
    7.60
    2.10
    76.00
    In the above report first column and the last columns are fixed and the other columns are dynamic depending upon the input selection:
    if input selection is Normal and RDO then only 2 columns w'd be created and the other 2 fixed columns.
    Can anybody help me how do I design such report....
    Thanks

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • How to create a folder dynamically in KM repository

    Hi All,
    Could you please let me know how to create the folder dynamically in KM...
    Thanks in Advance,

    >
    Romano Bodini wrote:
    > Hi,
    >
    > Search the forum. And the SDN. Then ask.
    >
    > [Creating folders in KM dynamically|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1761]
    >
    > Romano
    Actually, "look at the API documentation" should be in that list.

  • How to create alv table dynamically by performing action on the button.

    Hi all,
    my requirement is to create alv table dynamically.
    that is i will create two buttons
    1) show alv table
    2) close alv table
    if user selects show alv table then the alv table should be displayed.
    and if user selects clsoe alv table then the alv table should be closed.
    to create alv table dynamically  i have followed this procedure.
    under view properties i have added salv_wd_table component. then under the action of showalvbutton i went to code wizard and i have selected instantiate used component component use salv_wd_table. the following code will be generated
    with this code i am unable to display alv table dynamically correct me where i went wrong kindly send me the necessary steps how to create alv table dynamically
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_salv_wd_table( ).
    if lo_cmp_usage->has_active_component( ) is initial.
      lo_cmp_usage->create_component( ).
      endif.
    to close table i have used the following code. with this code i am able to achieve the functionality to delete the alv table
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_salv_wd_table( ).
    if lo_cmp_usage->has_active_component( ) is initial.
      else.
      lo_cmp_usage->Delete_component( ).
    endif.
    Thanks & Regards,
    Naveen
    Edited by: naveen.webhelp on Feb 10, 2011 5:52 AM

    Hi
    ALV table will be shown in the viewcontainerUI element.
    it is shown there empty if you dont fill the node bound to the data node of the interface controller of the comp usage
    SALV_WD_TABLE.
    and if you are not getting the table filled in the first place.
    then check have you mapped the DATA node to some node in the comp controller
    wht basically is your requirment is that you want to show ALV gird on click of one button and delete it on click of other button.
    there are many ways to do so.
    best way is control the visiblity of the viewcontainer UI element which containes the TABLE view of SALV_WD_table comp.
    create an attribute of type WDUI_VISIBILITY name say VIS.
    now go to the layout and bound hte visible property of the viewcontainer to this attribute VIS.
    then in the showalv grid button's eventhandler write
    wd_context->set_attribute(
    name = 'VIS'
    value = '02'
    and in the wddoinit and delete alv grid button's event handler write
    wd_context->set_attribute(
    name = 'VIS'
    value = '01'
    thanks
    sarbjeet singh

  • How to create a viewobject dynamically without using wizard

    Hi,
    I am Using jDEV 11G, i need to create a viewobject dynamically without using wizard, without binding from any entity.
    Actually my intention is to make a grid like in .Net, when a user want to create a new row in RichTable without using DB.
    just like shopping cart.
    i have done thsi code:
    ViewObjectImpl view=new ViewObjectImpl();
    view.addDynamicAttributeWithType("Att1","String",null);
    view.addDynamicAttributeWithType("Att2","String",null);
    view.addDynamicAttributeWithType("Att2","String",null);
    Row rw=view.createRow();
    rw.setAttribute("Att1","First1");
    rw.setAttribute("Att2","First2");
    rw.setAttribute("Att2","First3");
    view.insertRow(rw);
    I have a RichTable , i need bind this viewobject into that.
    Edited by: vipin k raghav on Mar 10, 2009 11:39 PM

    Hi Vipin,
    You can create the view object with rows populated at run time.
    [http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcquerying.htm#CEGCGFCA]
    For reference of how to create an empty rwo at run time on button click
    [http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html]
    ~Vikram

  • How to create a view dynamicly in plsql?

    I need to write a pl/sql package to create a view dynamic
    ,but i can't use 'create or replace view xxxx as select *
    from db where ...',I know the dbms_sql package can parse the
    'select' sentence,but i don't know how to create a view,only can
    drop a view,who can help me?
    thanks!
    null

    Try 'EXECUTE IMMEDIATE 'CREATE AS SELECT....' in your PL/SQL
    xhpxorcl (guest) wrote:
    : I need to write a pl/sql package to create a view dynamic
    : ,but i can't use 'create or replace view xxxx as select *
    : from db where ...',I know the dbms_sql package can parse the
    : 'select' sentence,but i don't know how to create a view,only
    can
    : drop a view,who can help me?
    : thanks!
    null

  • How to create a textfile dynamically(with in the loop) with given data?

    Hi all,
    Can anyone Please guide me how to create a text file in the given path dynamically? (with in the loop) with given data.
    For example:
    <%
    String data1="name";
    String data2="address";
    for(int i=0;i<10;i++)
    create the textfile at c:/test/sample.txt//name of the each file created being "sample.txt"
    //contents of text file will be
    data1+i; //to get name1,name2.....
    data2+i// to get add1,add2........
    delete(sample.txt) //to enable to create another file in the loop with same name
    %>

    The code which Ashokan mentioned is not is not creating a file.
    i used code given below to create and write into it.
    But, not is writing into it. I don't konw, where i am going worng !
    Code
    String sample2="C:/Ash/sample2.txt";     
                                                                                    FileWriter fw = new FileWriter(sample2,true);
                                            BufferedWriter bw=new BufferedWriter(fw);
                                            bw.write("EMP ID");     
                                            bw.newLine();
    Please help
    Regards
    aSh

  • How to create internal table dynamically based on a table entry

    hi Experts,
      I have table yprod_cat. It has product categories.
      In my ABAP program I need to create internal table dynamically based on the number of entries in the table.
      For example:
      If the table has 3 entries for product category
      1. Board
      2. Micro
      3. Syst
    Then create three (3) internal tables.
    i_board
    i_micro
    i_syst
    How can we do this? Any sample code will be very usefull
    Thanks & Regards
    Gopal
    Moderator Message: No sample codes can be given. Please search for them or work it!
    Edited by: kishan P on Jan 19, 2011 4:22 PM

    Our APEX version is 4.2We are using below SQL query to display radio groups dynamically..
    SELECT APEX_ITEM.RADIOGROUP (1,deptno,'20',dname) dt
    FROM dept
    ORDER BY 1;
    Created a form using SQL type and given abouve SQL query as source.. But when we run the page, there were no radio groups displayed in the page..
    Below is the output of the query..
    <input type="radio" name="f01" value="10" />ACCOUNTING
    <input type="radio" name="f01" value="20" checked="checked" />RESEARCH
    <input type="radio" name="f01" value="30" />SALES
    <input type="radio" name="f01" value="40" />OPERATIONS
    >
    If Tabular Form:
    Edit Region > Report Attributes > Edit Column > Change the Column type to "Standard Report Column"
    If normal Page Item:
    Edit Page Item > Security > Escape special characters=No.
    Pl read the help on that page item to understand the security risk associated with =NO.
    Cheers,
    Edited by: Prabodh on Dec 3, 2012 5:59 PM

  • How to create and use dynamic queue in JMS

    Plz tell me how to create and use a dynamic queue in jms and can reciever file lookup it as it lookup any server configurred queue(written in the server).

    Hi,
    We can use Azure File services to do this, for more information, please have a look at this article:
    http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx. The Azure File service exposes file shares using the standard SMB 2.1 protocol. Applications running in Azure can now easily share files between
    VMs using standard and familiar file system APIs like ReadFile and WriteFile.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to create a table dynamically in webdynpro

    hai everybody
    in webdynpro we know how to create at design time
    but i want to create it at runtime that is dynmamically i want to set the rows and coloums of the table at run time
    Thanks & Regards
    sravan

    I guess this should work,
    Suppose you want to dynamically create a Table (say Category) having a column called Category Code, then in the wdDoModifyView() hook method, just add the following code snippet,
    if (firstTime) {
    //Create the Table UI Element
    IWDTable table = (IWDTable) view.createElement(IWDTable.class, null);
    //Set the Table Header
    IWDCaption tableCaption = (IWDCaption) view.createElement(IWDCaption.class, null);
    tableCaption.setText("Category Table Contents");
    table.setHeader(tableCaption);
    //Create and add a Column UI element for the above table     
    IWDTableColumn column = (IWDTableColumn) view.createElement(IWDTableColumn.class, null);
    table.addColumn(column);
    //Set the required column header using the caption (Category Code here)                         
    IWDCaption caption = (IWDCaption) view.createElement(IWDCaption.class, null);
    caption.setText("Category Code");
    column.setHeader(caption);
    //Create a TableCellEditor and bind it to an attribute of the Category Node in the context     
    IWDTextView editor = (IWDTextView) view.createElement(IWDTextView.class, null);
    editor.bindText("tb_Category.cat_code");
    column.setTableCellEditor(editor);
    //Finally add the Table UI element to the view          
    IWDUIElementContainer root = (IWDUIElementContainer) view.getRootElement();
    root.addChild(table);
    You need to follow the same procedure for adding multiple columns to the table.
    Hope this answers your question!
    Regards
    Kishan

  • How to create report with dynamic columns with static row labels

    Hi All,
    I am creating one report as per attached format. I have labels on the right side of the report
    and data in 3 columns. The data is taken dynamically from the command query.
    It gets data from 3 different result sets/command queries.
    I tried creating the report horizontally instead of vertically, but the logo image I am not able to rotate in 270degrees.
    Can anybody tell me how to create the report...??

    Hi Abhilash,
    Thanks for the quick reply.
    Actually the problem is with the image, as I am not able to rotate 270 degree. Crystal report cannot support the rotation of image.
    i have another problem, I have to create a report in which
    Lables are fixed on the left side of report and 3 columns per portrait page. Those columns are
    dynamically created and shown in the report.
    The format is like the above. Can you please help me in doing this report, as I tried it doing
    with CrossTab. I am really stuck to this report.

  • How to create a database dynamically

    I am trying to create mysql database dynamically through java. Also please help me how to execute *.sql file in java.

    dheerajsea123 wrote:
    I am trying to create mysql database dynamically through java. Also please help me how to execute *.sql file in java.If possible it depends on the database and driver.
    If possible the exact methodology varies by database (driver shouldn't matter.)
    Normally it is not considered a good practice for traditional server applications.

  • How to create table columns dynamically ?

    Hi All,
    I am working on an SSRS report that will show sales in the past 5 years. If the user selected to view sales of past 3 years he will only see 3 columns. so How can I create table columns dynamically at run time and how can I make sure that their dimensions
    will adjust to fit the report page size.

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • How to create Invisible Element Dynamically?

    Dear All,
    I am trying to create a Form dynamically and for aligment prupose i need to create one InvisbleElement also dynamically.But i dont know why that is not reflecting in the Screen .The code is deploying properly without error but the Invisible Element is not getting created .The code i used is
    IWDInvisibleElement Invis1=(IWDInvisibleElement)view.createElement(IWDInvisibleElement.class,null);
    Invis1.setEnabled(true);
    Invis1.setVisible(WDVisibility.VISIBLE);
    thetransparent.addChild(Invis1);
    Can anyone please tell me if i need to set any property or if the method i am creating is wrong .Please guide me in the correct way.
    Thanks and Regards,
    Nishita Salver

    Hi,
    check "Dynamic Programming" part in below library file
    http://help.sap.com/saphelp_nw70/helpdata/EN/0f/f08841e3af1609e10000000a155106/frameset.htm
    or else,
    still you are getting Problem, create any other ui element and set its visibility to false. (dont know how far it will help you)
    regards,
    Pradeep
    Edited by: pradeep bondla on Jun 25, 2008 3:20 PM

  • How to create the folder Dynamically?

    hello friends,
    I want to create a folder dynamically in the tomcat. how to do that in the java class.
    any ideas appreciated.
    thanx in advance,
    -bala

    bala,
    this is dheenathayalan.
    Plz add ur suggestions.
    Im want to upload contents (mp3, ringtones, �) on dynamically created folder which is placed inside Webcontent folder (mycontext/webcontent/contents/images..).
    I did the all operations to need. But I want to create the folders Dynamically inside Web folder. For that im using File to create new Folders. Nw my question is How to get the path. When im using File it accepts like D:�/�/. I dnt want like this.
    I wanna REAL Path, so im using like this..,
    String realPath = getServlet().getServletContext().getRealPath("/upload/images");
    File directory = new File(realPath + File.separatorChar + justFileName);
    directory.mkdirs();
    f1 = new FileOutputStream(contentpath);
    f1.write(filedata);
    f1.close();
    but im getting ERROR while REALPATH. Im using STRUTS2. plz tell me how to do it.
    Plz Do the needful.

Maybe you are looking for

  • Disk Utility Reporting Hardware Failure on Mac HD- Not Repairable

    Hi! Looks like my hard drive is toast on my 24" aluminum case 24" imac. NOT under warranty although I bought it in Jan 09. DU reporting Mac HD in RED with message...'disk utility has detected hardware problem which cannot be repaired'. Ok. Will a sim

  • Auto gr of non stock items

    hi experts, can you do auto goods receipts of non stock items from a maintenance work order? thanks.

  • Set Queue dinamically in Send step

    Hi, Does anyone know if it is possible to set the queue name for EOIO processing in a send step of a ccBPM dynamically? Thanks Rodney

  • CCM5.1 upgrade path

    Hi, I am trying to find out if there is an upgrade path from CCM4.2(3) to 5.1 All I can find in the limited documentation are references of 4.1 to 5.1, anyone know? Thanks, Gary

  • Why is this error shwoing up when trying to acquire an image in labview?

    Error -1074396120 occurred at IMAQ AVI Write Frame   Not an image. Possible reason(s): IMAQ Vision:  (Hex 0xBFF60428) Not an image. This error keeps showing up when i try to acquire an image and save it. the VI being used is attached. Attachments: Im