Problem updating a table-row (changes are commited after "prerender()")

Hi,
I hope someone can help me on this:
Background-info:
The page which gives me problems should (and is) displaying one record of a query at a time. Depending on the button which can be pressed, the page should just display the next entry ("Next->") or change one column of the current entry and jump to the next entry ("Wrong / Next->"). After the last entry, the query should be (and is) executed again and the page should display the first column, which fits the query-criterias.
The problem:
If the query just finds one record, the record is displayed on that page.
By pressing the "Next->" button, the page displays the same record again (like it should). By pressing the "Wrong / Next->" button, the page displays the same record again, although - like described above - one column was changed by that action and the query (which should and is executed again)
should not find that record anymore. By pressing the "Wrong / Next->" button again, the page is not displaying a record anymore (like I expected it from the first time pressing that button).
Technical Info:
I am using one DataProvider for the "select" and an other one for the "update".
Both are working fine.
The "select" is called in the method "prerender()" and the "update" is called in the action of the button "Wrong / Next->".
I debuged the program and found out, that the column of the database entry is changing it�s value not after processing the action of the button (like it should), but AFTER processing the method "prerender()". I tried to force the action of the button to commit the changes (xyDataProvider.commitChanges();), but without success.
Code:
public String buttonWrong_action() {
    try
        // Execute the Update-Statement
        sessionBean1.getXyRowSet().setObject(1, "2");
        sessionBean1.getXyRowSet().setObject(2, cardId);
        sessionBean1.getXyRowSet().setObject(3, operatorId);
        xyDataProvider.refresh();
    catch(Exception e)
    // Jump to the next record (set cursor)
public void prerender() {
    try
        // Execute the Select-Statement
        sessionBean1.getZRowSet().setObject(1, operatorId);
        sessionBean1.getZRowSet().setObject(4, resultId); // ResultId (1 = Right, 2 = Wrong)
        zDataProvider.refresh();
        zDataProvider.cursorFirst();
        cardId       = sessionBean1.getCardRowSet().getString("id");
    catch(Exception e)
}

I suggest you read and understand Joel's blogs -
http://blogs.sun.com/jfbrown
Creator's CachedRowSet is designed for SELECT statements (only) and updating the ResultSet you get from that SELECT statement.
(http://blogs.sun.com/jfbrown/entry/using_rowsets_for_crud_or )
dataprovider.refresh() does not re-execute the rowset's command. It just means to "clear the previous results".
(http://blogs.sun.com/jfbrown/entry/cachedrowsetdataprovider_and_cachedrowset_info )
So here's how cachedRowSet's are designed to work:
Set you rowset's command to:
SELECT resultid FROM cardresult
WHERE cardid = ?
AND operatorid = ?
They your code would do something like this:
dp.getCachedRowSet().setObject(1, ...) ;
dp.getCachedRowSet().setObject(2, ...) ;
dp.getCachedRowSet().release() ;  // clear last results.
boolean gotOne = dp.cursorFirst() ; // will cause execution
if ( gotOne ) {
    dp.setValue('resultid', '2') ;
    dp.commitChanges() ;
} else {
    error("can't update") ;
}You'll have to adjust that code - it's just a generic example.
Don't forget to add try/catch for a RuntimeException!
The alternative is to write your own JDBC.
You can use either.
Personally I'd just write a little helper class to assist me with using plain old JDBC for this.

Similar Messages

  • Jserv.properties   custom changes are gone after  running autoconfig in 11i

    Hi,
    jserv.properties custom changes are gone after running autoconfigh in 11.5.10.
    Please let me know do we have any way to keep the changers after running autoconfigh also.
    Thanks,
    Venkat.

    Please see (Customizing an AutoConfig Environment [ID 270519.1]).
    Thanks,
    Hussein

  • How to update the table when change list item in classic report

    hi ,
    i worked with apex 4.2 and i create normal classic report with one select list(named loved)Column ,now i want to update table when user change the list with new value ,i can't create dynamic action to do this,i create check box with primary key and loop for check item to update the table but i can't get the value of list item. and for more speed the user want to do this when change the list value.
    my question
    1- how to do this by javascript and get the value from list item and update the table with new value
    2- is i must use API to create list item so i can get the value of item in report or what.
    Thanks
    Ahmed

    I coded the following to give you direction:
    1. In the "Element Attributes" section of the DEPTNO column, I call a javascript function as:
    onchange = "javascript:updateTable(this);"2. I wrote a simple javascript function that shows an alert when the user changes the select list as:
    <script language="JavaScript" type="text/javascript">
    function updateTable(pThis)
        var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
        alert('Row# - '+ vRow + ' has the value - ' + pThis.value);
    </script>Now, you can call a AJAX on-demand process inside the javascript function to update the database value.

  • Problems updating a table.

    Hey, I'm writing a program to manage a mysql music library. So far everything is working ok, but I seem to have run into a wall. I have my user interface create a custom table model that displays my data on a frame. I want to have a refresh button that updates the table based on changes made to the database. I've been trying to figure this out for several hours now and haven't come up with anything useful. Anyone have any advice? I've searched the web pretty but haven't really come up with anything that helps me out. My main problem I guess is that I need to call a method that sends new data to the tablemodel but the table is inside of the user interface so I can't really call a method that refers to a table it doesn't have access to. So yeah. Sorry if I'm not being very clear. Thanks!

    Alright I don't know what's going on now. Here's my code:
    Edit:In my user interface class this is how it's declared:
    SongTableModel myTableModel = new SongTableModel();
        JTable table = new JTable(myTableModel);and then in my database update class:
    SongTableModel myTableModel;
       public DBCom(SongTableModel stm) {
            myTableModel = stm;
        }and a in my add song method I inserted this to update the tablemodel data.
    myTableModel.updateTable(getData());But when I run this I get a null pointer exception at that piece of code. It must be something simple but I can't figure it out.
    Here's the tablemodel update method:
       public void updateTable(ArrayList<Song> s) {
           songs = new ArrayList<Song>();
           songs.addAll(s);
           fireTableDataChanged();
       }Any ideas?
    Edited by: techgeek24 on Apr 25, 2008 9:48 PM

  • Table row change color on hover

    Hi,
    I don't know if it's possible to change table row color on mouse hover, I've been looking at skin-selectors (http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/skin-selectors.html#Global%20Selectors) and I haven't found any row style class for af:table Component... if anyone knows how to achieve this I would be thankful.

    Hi,
    I replied to the other question of yours. I don't think this is possible because the row is not a component that can have a style applied to it. You may be more successful in applying the CSS to the components (outputText or inputText) on the table cells.
    Frank

  • Urgent : update of table QALS  through transaction QA12 after save

    Hello Experts ,
      I need to update the table field SELHERST of standard table QALS through transaction QA12 after the save button is clicked  .
    I have implemented the exit QEVA0010 which is triggered after clicking the save button , and have put the update command there , followed by commit work statement .
    But it is not updating the table QALS .
    Thanks in advance ....

    When the SAVE button is pressed, SAP execute some checks and launch the update task, if you want that your changes are not overwritten by SAP you need to submit those for execution during update task.
    So you need to use instructions like
    - PERFORM ON COMMIT
    - CALL FUNCTION IN UPDATE TASK
    and execute the update in one of these. (Reference [Updates in the R/3 System (BC-CST-UP)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCSTUP/BCCSTUP_PT.pdf])
    You may also try to force the update in the main program, declaring a pointer (field symbol) in the calling program data '(SAPMQEVA)QALS'  (But that's not very correct)
    Regards

  • Transforming Entities to Tables - No changes are saved to the database

    Hi,
    I have inherited a Designer 9i application which has 4 containers. Changes were maid to one container and I'm trying to transform Entities into Tables.
    The transformation runs fine and I get "Changes posted to database" messages.
    The problem is when I go in the RON and try to see if changes were maid to the Tables: none ! Nada !
    Everything that came with the application (dmp file from vendor) is there but nothing of the new stuff...
    I tried Default mode and "Advanced" several times to no avail...
    I'm using Designer 9.0.2.10 on a 9i database... Everything is compiled and functionning properly beside to changes that won't get saved into Tables...
    Any ideas ?
    Thanks !

    The fact that you are using the repository owner may be your problem. NEVER use the repository owner for day to day work. The only tool that should ever connect as the owner is the Repository Administration Utility (RAU). Instead, have the DBA create a user for your day to day work, use RAU to grant that user access to the repository, and in the Repository Object Navigator (RON) grant the user rights on various applications.

  • Updating database table for 'CHANGE' and 'ADD' buttons.

    Hi,
    I am working on module pool program. Here i am using table control.Below is my requirement:
    1) I have designed a selection - screen with 'CHANGE' and 'DISPLAY' buttons and in screen 100 i have 'ADD' and 'SAVE' buttons.
    2) when i click on 'CHANGE' , it will move to screen 200 here i need to change quantity field for that particular record which is in table control.once i change the field value and click on 'SAVE'  a message should be populated that "RECORD IS SAVED' and  this record should be updated in database table with new quantity field value and it should return back to my selection screen.
    3) When i click on 'ADD' , it should display already existing records in disable mode and a new line should be added inorder to enter new records. Once i enter the data and click on SAVE, this new record should be saved in the database table along with existing records.
    Kindly suggest me a sample code for this as am new to table control in module pool programming.

    Hi Gaurav,
    I've a similar problem!! any solutions to your problem!!

  • Updating a Table row in OAF

    Hi All
    I have one table with one editable column. Once the user enters the value, the corresponding row has to be updated only in front end withopout updating the database. Please provide help on this.
    Thanks

    Either create readonly viewobject and bind it with the table
    or
    Create a transient attribute in the VO and bind it with the table column.
    Now the changes made to the VO will be displayed in the screen and it wont go to the database.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • HT5622 Apple ID profile update does not allow changing area or country codes

    Is there any way to do this?  Or to report the problem to a webmaster?  (I presume the country code for US is 1.)
    It will only accept putting the are code in the country code box and leaving area code box empty.  Any other change attempt just produces "Please specify a vaild phone number."

    Solved with assistance from iTunes support.  The main problem was that you cannot use an e-mail address which is associated with your existing account.  So the answer is to set set up a new e-mail address with your Internet Service provider.  Next step is to log into iTunes using your existing appleID (which in my case was a non e-mail address as mentioned in my question) and then modify your itunes id and e-mail account, both to the new e-mail address.  I tried it and it worked.  All downloaded history such as itunes music and apps that I have downloaded onto my devices over time has been retained.  Furthermore I can now use the "Find my iPhone app" to find both my iphone and iPad.  Likewise will be able to use this revised appleid to access iCloud once available and synch my apps etc.,  Very pleased with iTunes Support's prompt response and remedy.

  • Automatically update a 'Last Updated By' field when changes are made a database record.

    Basically I'm building a database app using mySQL and PHP.
    I'm from a design background, rather than a techie one, so I'm far
    more comfortable using the DW and phpMyAdmin parts, but less so
    with any code.
    We want to have a 'Last Updated By' field that automatically
    populates with whoever created or last edited a record.
    What's the best way of achieving this?
    I've looked at some mySQL stuff, but all looks a bit over my
    head to be honest. Have a table of Users in phpMyAdmin - not one as
    part of the database, but under privileges - so where 'root' is,
    plus another couple I've added.
    In the web directory, I just have a standard connection file
    that looks like :
    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_connDevelopments = "localhost";
    $database_connDevelopments = "developments";
    $username_connDevelopments = "root";
    $password_connDevelopments = "password";
    $connDevelopments =
    mysql_pconnect($hostname_connDevelopments,
    $username_connDevelopments, $password_connDevelopments) or
    trigger_error(mysql_error(),E_USER_ERROR);
    ?>
    But how do I do it so that people log in to the database?
    Alternatively, can I just use DW's log in (ie log in to
    particular pages, rather than users log in to the database, using
    database privileges?
    And from there have a hidden field in my insert and update
    pages that's set to the current user, and that value can then be
    inserted in the table?
    Any help or pointers with this greatly appreciated.
    Cheers.

    Thanks David. That sounds about right - the last app I did
    was an online photo library, and used the Log In stuff for that.
    With this one, we want to track changes, as we'll follow the
    progress of the developments from early info right through to
    completion - hence last updated, and last updated by fields.
    So I figured it should be do-able as an extension of the log
    in stuff, ie pass the stored current user somewhere.
    Regarding security - this is just a local app running on an
    internal server, rather than out there in the wild.
    To test it out, I've added a 'LastUpdatedBy' field to my
    other app, and added in a hidden field in my update page :
    <input name="LastUpdatedBy" type="hidden"
    id="LastUpdatedBy" value="$_SESSION['MM_Username']">
    I have the code that does the inserting :
    if ((isset($_POST["MM_update"])) &&
    ($_POST["MM_update"] == "form1")) {
    $updateSQL = sprintf("UPDATE Photos SET Link_ID=%s,
    Title=%s, Rights=%s, Rights_Details=%s, Credit=%s, Width=%s,
    Height=%s, Year=%s, Supplier=%s, Photo_File=%s, Orientation=%s,
    Admin=%s, Region=%s, Country=%s, Easting=%s, Northing=%s,
    LastUpdatedBy=%s WHERE Photo_ID=%s",
    GetSQLValueString($_POST['Link_ID'], "text"),
    GetSQLValueString($_POST['Title'], "text"),
    GetSQLValueString($_POST['Rights'], "text"),
    GetSQLValueString($_POST['Rights_Details'], "text"),
    GetSQLValueString($_POST['Credit'], "text"),
    GetSQLValueString($_POST['Width'], "text"),
    GetSQLValueString($_POST['Height'], "text"),
    GetSQLValueString($_POST['Year'], "text"),
    GetSQLValueString($_POST['Supplier'], "text"),
    GetSQLValueString($_POST['Photo_File'], "text"),
    GetSQLValueString($_POST['Orientation'], "text"),
    GetSQLValueString($_POST['Admin'], "text"),
    GetSQLValueString($_POST['Region'], "text"),
    GetSQLValueString($_POST['Country'], "text"),
    GetSQLValueString($_POST['Easting'], "text"),
    GetSQLValueString($_POST['Northing'], "text"),
    GetSQLValueString($_POST['textfield'], "int"),
    GetSQLValueString($_POST['LastUpdatedBy'], "text"));
    The bits in bold I've added for the LastUpdatedBy - but no
    joy - that's entering $_SESSION['MM_username'] into the table.
    What should the syntax be?

  • Problem with multiple table row selection

    Hi all
           I have a rfc which fetches me a bunch of records and displays them in a table,say A.
           I have to select multiple records from this table and hit a button to navigate to next screen..where I will review the selected entries from table A..
           Cardinality is 0..N,Selection cardinality is 1..N.
    and selection mode as "multi"
    But I am not able to select multiple entries in tableA..
    Pl send me some sample code which would help me solving this issue...
    Thanks in advance

    hi,
    this is the code i have written.
    int size = wdContext.nodeHeader().size();
           IPrivateGetView.IItemElement e1 = wdContext.createItemElement("instance");
           for(int i=0;i<size;i++)
           if(wdContext.nodeHeader().isMultiSelected(i))
               e1.setDel(wdContext.nodeHeader().getHeaderElementAt(i).getDel());
                wdContext.nodeItem().addElement(e1);
    // i am trying to add the selected rows from one table to another table.
    By using above logic i couldn't select more than one row.
    Can u help me how to select more than one row and add them to another table.
    Thanks in advance.

  • Problems update a table

    HI, I am trying to write a simple procedure to divide a table column with a value from another column of a table. If I hard code a value for v_case_count, it works ok but sets the qty_ordered_2a column to null everytime I use the variable v_case_count. Please help.
    CREATE OR REPLACE procedure set_target_units
    IS
    v_case_count NUMBER;
    cursor set_qty_ordered IS
    select msi.attribute11 into v_case_count from mtl_system_items_b msi, NFPC_PO_EDI850_IN_LINES npl
    where msi.organization_id = '221'
    and msi.segment1 = npl.PROD_SERV1_2B
    and msi.attribute11 is not null;
    BEGIN
    For cursor IN set_qty_ordered
    LOOP
    update NFPC_PO_EDI850_IN_LINES
    set qty_ordered_2a = ROUND((qty_ordered_2a/v_case_count),0)
         where rec_2a like '%SYS%';
    commit;
    END LOOP;
    END;
    /

    Sorry Pratz. This is my first pl sql program. I have this code now.
    CREATE OR REPLACE procedure set_target_units
    IS
    v_case_count NUMBER;
    cursor set_qty_ordered IS
    select msi.attribute11
    from mtl_system_items_b msi, NFPC_PO_EDI850_IN_LINES npl
    where msi.organization_id = '221'
    and msi.segment1 = npl.PROD_SERV1_2B
    and msi.attribute11 is not null;
    --and segment1 = '3121737';
    BEGIN
    For rec IN set_qty_ordered
    LOOP
    update NFPC_PO_EDI850_IN_LINES
    set qty_ordered_2a = (qty_ordered_2a)/(set_qty_ordered.v_case_count)
         /*round((qty_ordered_2a/v_case_count),0)*/
    where rec_2a like '%SYS%';
    commit;
    END LOOP;
    END;
    I would appreciate if you could see what is wrong.

  • 6.5 after publishing an update to page, the changes are now showing even when i hit refresh. Yet, on outside internet browser changes are there. what am i missing

    I know the answer is a setting issue, but I cannot figure out what it is. any help appreciated

    Please clean your temp files from the location mentioned below. It happens sometimes that Contribute pick the page from the temp location.
    you may follow the steps mentioned below to delete temporary files stored on your machine.
    Open the Start Menu.
    Search for Run and click.
    Type %temp% and press Enter.
    Select all files and click Shift + Del key.
    Also you need to delete the Preferences of Contribute 6.5 as mentioned in the document linked below.
    http://blogs.adobe.com/contribute/2011/11/launch-contribute-freshly-by-deleting-preference s.html
    Regards,
    Rajeev.

  • SG200/300 Changes not commiting after reboot - LAG - Yes im saving config.

    Hi there,
    I've noticed on both a SG200-26 and SG300-28 that once I've completed a configuration change and save the running config to the start up config that it reverts after a reboot. It seemed very weird to me so I started downloading the configuration prior to the reboot to confirm that the running config is the same as the start up and it is verified but once I reboot a different config is there. The second I login to the switch it's also flashing the save icon at the top.
    Has anyone experienced this is? both switches are running the current firmware, and I've tried different web browsers and different pc's to confirm it wasn't a caching issue.
    couple things to add, I noticed it when creating a LAG group. I'll removed the target ports from any vlans and add then to the LAG, and the vlans to the lag. save and reboot and then it reverts back to the ports not being in a LAG and being in the existing vlans. if I do remove the ports from the vlans and save and reboot the settings hold oddly enough.
    As well when removing the ports from the LAG I get the following error "Configuration Database locked by terminal 0 application - please try later." I need to do one by one, and the odd thing is these ports revert back to the previous vlan's they where on.

    Hello,
    What you are describing definitely isn't normal.  I see a lot of people who's VLAN configuration change around after a reboot, and that is usually because of smartport macros, but that isn't really what your issue sounds like.  I would try disabling smartport on the LAG members anyway (or globally if you aren't using it for anything else, just note on earlier firmware this will set all your ports back to trunk with VLAN 1 untagged when you first do it)
    One thing I can say is the individual ports retain their own settings once you add them to the LAG, they just ignore them since the LAG settings are what matters at the point.  Once you remove the from the LAG they will revert back to whatever their settings were before you added them.
    You mention the latest firmware, did you also upgrade the bootcode on the switches?  Odd things like your error message crop up when the bootcode is not updated as well, since we changed around some of the filesystem for newer firmware versions.  
    The fact that this happens on both of them indicates to me that it probably isn't a hardware problem, especially since it is two different models.
    You mentioned that when you log in your save icon is flashing, I am wondering does the switch make you change your password when you login again?  If so it sounds like they are being reset to factory somehow.
    Speaking of that, I would recommend once you upgrade the firmware to factory default them and reconfigure them manually.  
    Where do you see that error message, in the GUI or in the CLI?  It sounds like you have tried both, but I cannot really tell.  Posting your log files may be useful too, you can usually see there if your configuration save went through properly or not.
    If the reset and reconfigure and bootcode all check out, go ahead and give us a call at the SBSC and we can get  case opened and take a look at what is going on here.  I have set up lots of LAGs in the lab and on customer's equipment, and haven't run across this issue before.
    Hope that helps a bit and thank you for choosing Cisco,
    Christopher Ebert - Advanced Network Support Engineer
    Cisco Small Business Support Center
    *please rate helpful posts*

Maybe you are looking for

  • Sales Orders Report - Requested Delivery date fails.

    Hello, If a customer orders Item A Quantity 10 with a requested delivery date as 10.09.2008 In sales orders under Schedule line tab it will be displayed as below if schedule line fails Delivery date Order Qty Rounded Qty Confirmed Qty 10.09.2008     

  • Easy Tabs breaks when a calendar list view is added and stops working on sub sites (?)

    SP 2010 on premise. When I add a calendar list view web part to Easy Tabs it wipes out all the other web parts and causes errors. Libraries and other web parts seem fine. I haven't tried other list views or been able to find out if they're supported

  • Javascript in java server faces

    Hi All, is it possible to use javascript in java server faces. If it is possible, How to get component (textbox, listbox, combo box) values in java script ?

  • Video chat errors

    I see that there are numerous posts out there regarding the problems with trying to video chat. I too am experiencing the same problem. I have checked things from other posts and confirmed that I have them setup correctly (i.e. allow all incoming con

  • How to hide the on screen bottom navigation bar - ...

    I'm new to Windows Phones , and I was looking at the Lumia 630 Dual sim version but discovered that it has an on screen  navigation bar , instead of physical capacitive buttons. I can't seem to find out a way to hide  the on screen navigation bar , d