How to "roll back" the model if a database update fails

I'd like to know if there's a way to "roll back" the model (the values in the managed beans) if a service call to a database fails during the Invoke Application phase. My understanding of the JSF lifecycle is that the values in the model are updated before a service call to a database would happen. If the database update operation fails, it seems to me that the data in the model and the database would be inconsistent.
For example, say I have a ridiculously simple application that updates a names database. The fields are id, last name, first name. The application has a simple view that allows the user to update a name in the database. The user updates the last name field for a particular record from "Doe" to "Smith" and clicks "submit". The request goes through the lifecycle, the model values are updated from the web form during the Update Model Values phase, then the call to update the database fails during the Invoke Applications phase (the database connection failed). When the Render Response phase completes, the UI would display an error message where I put <h:messages> but the last name value in the UI would show "Smith" instead of "Doe". Is there something I can do to roll the model value back to "Doe" if the database call fails?
I know that I could redirect to a technical error page, but I'd like to avoid it unless it is the best thing to do.
I'd appreciate any advice you can offer.
Thanks.
- Luke

I'd like to know if there's a way to "roll back" the model (the values in the managed beans) if a service call to a database fails during the Invoke Application phase. My understanding of the JSF lifecycle is that the values in the model are updated before a service call to a database would happen. If the database update operation fails, it seems to me that the data in the model and the database would be inconsistent.
For example, say I have a ridiculously simple application that updates a names database. The fields are id, last name, first name. The application has a simple view that allows the user to update a name in the database. The user updates the last name field for a particular record from "Doe" to "Smith" and clicks "submit". The request goes through the lifecycle, the model values are updated from the web form during the Update Model Values phase, then the call to update the database fails during the Invoke Applications phase (the database connection failed). When the Render Response phase completes, the UI would display an error message where I put <h:messages> but the last name value in the UI would show "Smith" instead of "Doe". Is there something I can do to roll the model value back to "Doe" if the database call fails?
I know that I could redirect to a technical error page, but I'd like to avoid it unless it is the best thing to do.
I'd appreciate any advice you can offer.
Thanks.
- Luke

Similar Messages

  • Can you roll back the iMovie 9.0.6 update as it has trashed iMovie for me?

    Since the auto update of iMovie to 9.0.6 I cannot open iMovie and more - it just crashes every time trying to import the projects.  I either need to KILL all old projects or roll back iMovie so that it is usable!!!
    I found the answer at https://discussions.apple.com/message/18684126#18684126 once I placed the question!
    Thanks all

    There's a workaround ..   delete the currently installed iMovie app. Then reinstalling will give you iMove 9.0.6.
    Use this free utiilty to uninstall iMovie >  Download AppCleaner for Mac
    Once it's uninstalled, you can re download iMovie for free using the same Apple ID it was originally purchased from.
    How to re download apps from the Mac App Store:
    Open the App Store. From the menu bar click Store > Sign In
    Click Purchases from the top of the App Store window.
    Select which apps you want to re download. Then right or control click where you see Installed  then click Install.

  • How to roll back if one of my sql transaction fails?

    I want to insert record into 2 tables at the same time and they must be added both or neither, how to do this in Java? I'm using SQL Server.
    Thanks!

    You can actually handle this directly IN SQL Server.
    For example, this is SQL for SQL Server 7.
    BEGIN TRANSACTION
    Update ....
    COMMIT
    SQL Server will automatically update the table if it reaches the Commit keyword.

  • How to roll back changes made by other user in nwdi?

    hi all
    my doubt is.
    if there are errors in the WD NWDI project (cause developer before me had deleted/ added some of the code which is causing those errors).
    how to  roll back the code changes which were made by other user.
    i think through sync option but  when we sync to a earlier date we cant check out the code to make changes.
    help me.

    thanks rohit.
    but if there are changes in the context, i mean if one more attribute is created and it is been used a UI element.
    then the above process works.
    My doubt is.
        src folder(configuration,packages,mimes)
    Will these file contain all the code including  the context attributes and the mapping informatin and every thing else.
    (except Libs)???????
    can you plz tell me where the context attributes and mapping informantion and source code and model information are stored (in which folder).
    thanks in advance

  • The install wizard stops and "rolls Back" the install and just gives the attached notice of the install error...how can this be corrected?

    The install wizard stops and "rolls Back" the install and just gives the attached notice of the install error...how can this be corrected?
    The notice is inserted first and the stopping point is second.

    Da ich gar kein Englisch kann kann ich auch nicht sagen was sie mir
    geschrieben haben ich kann nur Vermuten was das sein soll es tut mir leid
    aber ich kann ihnen keine Konkreter Antwort geben alle Sprechen Englisch
    nur ich nicht mehr kann ich dazu nicht sagen
    Constantin Preda
    2015-02-12 21:45 GMT+01:00 Claudio González <[email protected]>:
        The install wizard stops and "rolls Back" the install and just gives
    the attached notice of the install error...how can this be corrected?
    created by Claudio González
    <https://forums.adobe.com/people/Claudio+Gonz%C3%A1lez> in Adobe Reader
    - View the full discussion
    <https://forums.adobe.com/message/7189357#7189357>

  • How to roll back to the good last vershion where plugins work

    how to roll back to the good last vershion that all plugins work ok
    as 4.0 freezes with some sites.

    You can install previous version of Firefox from [http://www.mozilla.com/en-US/firefox/all-older.html here].
    <BR>For installation instructions, see this article: [[Installing a previous version of Firefox]].

  • How do I roll back the BIOS update on Satellite U400-157?

    I recently updated a Tempro alert for BIOS update for the note book. I now notice that the screen blanks out a few times at PC start up. It was't there before. How do I roll back the BIOS update to an earlier one.
    I don't get to see the BIOS update screen else where other that the time that I did the BIOS update.

    Hi
    To be honest I dont understand exactly what is your problem.
    You said: . I now notice that the screen blanks out a few times at PC start up.
    What does this mean exactly? Is your display black until Windows has booted up?
    To be honest, I dont think that BIOS update would be the reason for that go to BIOS (press F2) and set the BIOS to default settings (F9) and save the changes (F10).
    If you want to get back the earlier BIOS version, then you will need to flash the BIOS ROM module using an DOS based BIOS version. On the Toshiba European driver page you can find only the win-based versions

  • How to roll back to 1.7 EFI Firmware?

    Hey folks,
    I just updated my late 2008 Macbook Pro to EFI Firmware v1.8, and am finding that suddenly my Firewire audio interface can't play a single thing without crackling, even in simple programs like Media Player, on my Boot Camp partition.
    Using firmware version 1.7, everything was just fine. How does one roll back to an earlier firmware version? Does it have to be done by an Apple Tech? I am fairly certain that this can be done, as people in other threads seem to have successfully done it, and mention a 'rollback tool.' However, I can never seem to find any links or instructions.
    Thanks!
    HK

    The "roll back" tool you are referring to is not for your model (late 2008). It was for the mid-2009 MacBook Pros. The machines do not use the same firmware. Rolling back the firmware is something that an Apple tech would not likely be able to do for you. The firmware roll-back tool for the mid 2009 models was not even generally available to Apple Geniuses. It was released only by Apple Corporate after much complaining about a specific problem plaguing those machines. Even after that, most Apple Geniuses were unaware of the tool. You may want to give Apple Support a call and see what they have to say. You may want to check with the manufacturer of your interface to see if they have a resolution.

  • How do I see the model and manufacturer of my wifi card?

    how do I see the model and manufacturer of my wifi card?
    MacBook Pro 13-2011

    Shootist007 wrote:
    That is not correct. Apple really doesn't build any parts. They are all made by some other manufacturer and then installed in Mac computers as Add-on cards or soldered onto the motherboard, Apple Speak Logic board, before it is installed in the computer.
    As to the WiFi card Broadcom makes most of the chips and they are then soldered onto a Duaghter card that is then inserted in a socket. The socket for the WiFi card is near the back of the system just behind the Superdrive. That is on the standard MBP. On the Retina models I'm not sure where it is placed.
    Strebsjig wrote:
    As far as I know, Apple only uses their own AirPort 'cards' (they aren't really cards anymore, but integrated chips). So the manufacturer is Apple, and the model is just AirPort.
    Technically, you are correct. The original manufacturer is Broadcom, but all the WiFi chips Apple is using are rebranded as Apple, Inc. AirPort Extreme.

  • Roll back the updated records

    One of our application users accidently updated approximately 1000 records of one of our Production Database tables .There are 3-5 records usually added /modifiled to this table per day .we also
    restore a copy of our production database to Test server  each night .In this situation, we wanted to roll back all transactions for that table those are updated by user accidently
     so we decided to rename the production table and tried to copy table to production from the test database .Unfortunally
     we could not rename the table name since there are a few production database tables are dependent on that table .Finally we compared the affected records of production table
     with Test database table and created update script that updated all affected records with the original values .This recovery step was very time consuming especially during the business hours . when someone accidently delete ,update and modified
    data , in this case what would be the possible options that SQL DBA can use to roll back the transactions without any downtime ?
    Has someone used the ApexSQL log against the Production database to recover data before ?
    Thank you in adavance for you help .
    Daizy

    Always prepared for a rollback steps (Scripts ), and make sure you have scheduled backups ( full and tlog )
    If you know the exact time then you may try for point-in-time recvery using your full_tlod backup.. for this you should aware the exact time and again you have to do some manual work, because this is unplanned and human mistakes always risky and etc.., You
    have to make sure that you are executing  correct scripts and you may have to test the same in Test servers before executing.
    Not sure how this ApexSQL works for rollback... you may have to test using your Test servers
    WITH FILE=5, NORECOVERY, STOPAT = 'Apr 15, 2020 12:00 AM';http://msdn.microsoft.com/en-us/library/ms179451.aspx
    Raju Rasagounder Sr MSSQL DBA

  • Element 9 error "Rolling back the installation of Elements 9" failed.??

    I just bought Elements 9 for Windows. And anytime I try to download it, it says "Rolling back the installation of Elements 9" then says "shared technologies failed"?
    I have tried multiple things listed on here and nothing helps.
    Does anyone know how to fix this??
    Thanks~!

    Hello,
    I noticed that there is a log we can refer to:
    C:\Windows\CCM\Microsoft.ConfigurationManager.AssetProvider.InstallLog
    Since the client software is not installed successfully, I'm not 100% sure if the folder persists.
    In addition please check event log. Pay attention to those logs regarding WMI.

  • Roll Back the Sales Order After Adding

    Hi Experts,
    I want to roll back the system form trasaction like Sales Order. After adding the Sales Order immediately i want to roll back the transaction.
    I used the Company.Transaction Object, but it is only working on User Tables. Not in System Forms like Sales Order.
    Can you please tell me the solution for this ASAP.
    Thanks in Advance,
    G.Suresh

    Hi Petr,
    You didnt get my point. In my concern is, i am going to add Sales Order by Manually not using code.
      In FormDataEvent of the Sales Order
                Select Case BusinessObjectInfo.EventType
                    Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD
                     If BusinessObjectInfo.ActionSuccess = True Then
    /***** This Code for getting current transaction of the Sales Order *****/
                            Dim oObject As SAPbobsCOM.Documents
                            oObject = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                            oObject.Browser.GetByKeys(BusinessObjectInfo.ObjectKey).
    /**** here i want to rollback the saved sales order  ****/
                    End If
                  End Select
    Can you tell me, how i ll rollback the already saved transaction which added by user from Sales Order Screen not in code.
    Thanks in Advance,
    G.Suresh.

  • Roll back the last update

    How can I roll back the last Firefox update on Feb 27th 2013. I really don’t like the built in PDF Viewer. I like it the way it was.
    Thanks
    Jay

    Thanks
    I set the Portable Document Format (PDF) to use Adobe Acrobat (in Firefox). It worked great, it works just like it did before the update.

  • How to roll back when procedure fails

    Hi All,
    In my process using procedures i am droping the temp tables and creating temp tables ,if any procedures fails how should roll back all the process
    Procedure1(droping tables)----->procedure2(creating table1)--------->procedure3(creating table2)------->procedure4(Validaating accounts in table2 and creating seperate table)
    Any suggestion please
    Thanks in Advance

    Let's say in your package you have your 4 procedures (Proc1, Proc2, Proc3, Proc4).
    Also create 3 additional procedures:
    RollBack1 -> Does the opposite to Proc1 (i.e. if Proc1 drops a table, then Rollback1 will create it)
    RollBack2 -> Does the opposite to Proc2
    RollBack3 -> Does the opposite to Proc3
    Your logic will be:
    If Proc1 is successful, then execute Proc2.
    If Proc1 is unsuccessful, then end.
    If Proc2 is successful, then execute Proc3.
    If Proc2 is unsuccessful, then use an on failure path (red line) to execute RollBack1.
    If Proc3 is successful, then execute Proc4.
    If Proc3 is unsuccessful, then use an on failure path (red line) to execute RollBack2, followed by RollBack1.
    If Proc4 is successful, then end.
    If Proc4 is unsuccessful, then use an on failure path (red line) to execute RollBack3, followed by RollBack2, followed by RollBack1.
    It mightn't be necessary to undo everything - but you'll know your own business needs to make a decision on that.

  • How to "roll back" SAP APO PPDS planning batch run from infeasible batch mid-point to before start of planning batch run?

    Hi Experts,
    We are investigating if any SAP customer that implemented SAP APO PPDS has ever attempted to establish a "roll back" of the SAP APO PPDS created supply plan to a defined point before the start of the SAP APO PPDS planning batch run?  
    We have a situation where - in the middle of the planning batch run - randomly or intermittent the batch run hangs or runs a step for multiple hours that normally, at most days, takes only a few minutes to run.  In a situation like this, the supply plan is not in a state where customer sales orders can be promised  (using GATP CTP) or planned orders can be converted to production orders and published to SAP ECC, etc since the plan may be capacity infeasible or simply partial or incomplete.   To not hold the business operations hostage to wait resuming operations (promise customer sales orders, convert and release and execute orders to transfer, deliver, produce, or purchase) for hours or days, we need to find a way back to the original plan right before the nightly PPDS batch planning job started.
    We already close all the queues from ECC to APO, thus, no CIF traffic from ECC to APO.  We also shut down the customer sales order feed into ECC as normal process for duration of the APO PPDS batch planning run.  Thus, functionally,  we are theoretically in a situation to simply go back to a PPDS and active planning version save prior to the run.  Yet, many more technical and BASIS-related questions remain on how to roll back to a state where the plan was not compromised.
    This inquiry is to learn if any other SAP customer has ever established a process to roll back SAP APO PPDS to a previous point in time supply plan to resume operations?  Whatever the reasons are, be it after a failed  batch run, or any time during the normal interactive plan day.  
    Additional information about our design and plan:  
    1.  We have a two year horizon supply plan in PPDS
    2.  We only publish to ECC 14 days worth of planned orders, stock transfer requirements, and purchase requirements
    3.  We convert planned orders to production orders and release production orders in ECC 2 days before first operation starts
    4.  We convert PR's to PO's and STR's to STO's in ECC  2 days before execution (ship or submit to vendor)
    Any indication where a SAP customer has developed and uses a process to roll back an SAP APO PPDS- planned supply plan to an earlier point in time or version would be helpful to know.
    Regards,
    Manimaran M.

    Hi  Manimaran,
    Saving in Simulation means in DS board when you click on save it provides you option to save sim version or adopt to active version. If you copy to inactive version you cannot copy back  trasaction data specially PPDs orders back to active version again while if you save in simulation you can adope it to active version at any point of time. YOu can adopt simulation version changes to active version using T-code /SAPAPO/CDPSS0
    Copying to active version means you copy data from version 000 to some other active version while here results are kept simulation,

Maybe you are looking for

  • Can't scan with feeder, but feeder works when printing

    Hello Everyone, Hope you can help me. The feeder works fine when printing, but does not feed when scanning. However, the scanner works fine on the flat bed. so... The feeder works when printing the scanner works on the flat bed, but I'm not able to s

  • Document in Multiple curriencies

    Hi gurus, i need to know if there is a way to display a document in a currency of our choice which is other than the local currency and the document currency... suppose local currency = SAR document currency = USD and i want to the display document u

  • Z10 camera problem

    Dear all. Have a problems with z10 camera. After 50 photo - 2 days of use - device do not show last photo in the memory. Only rebooting helps. I`ve tried both with and w/o microSD card. The phone was my present to wife (because it white : (( ) so she

  • HT4059 How can I cancel a pre order in ibooks

    I need to cancel a preordered book on iBooks with my iPad... Help

  • Document splitting - urgent

    Hi: We are using SAP 6.0. We are trying to settle to an AuC and then to an asset. The process works fine till creation of an asset but in the accounting document the profit center is not assigned to the Fixed asset APC account. In other words the doc