• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: method failed to update row
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: method failed to update row


  • Subject: Re: method failed to update row
  • From: Wolfram Stebel <email@hidden>
  • Date: Sat, 20 May 2006 12:59:06 +0200
  • Thread-topic: method failed to update row

Am 19.05.2006 22:30 Uhr schrieb "Robert Walker" unter
<email@hidden>:

Thanks Robert,

i took a second look at the docs and found that TolerantSaver should do it.
So to answer my question: TolerantSaver is the correct Solution.
I made the following changes to the save method of TolerantSaver :

// improved exception handling for validation
// changed NSException to EOGeneralAdaptorException
// added catch of remaining Exception for debugging purpose
public static String save(EOEditingContext ec, boolean writeAnyWay, boolean
merge) {
    System.out.println("TolerantSaver: save...");
    try{
        //System.out.println("about to save changes...");
        ec.saveChanges();
    }catch ( NSValidation.ValidationException ve ){
        System.out.println("TolerantSaver: EO ValidationException");
        throw ve;
    }catch ( EOGeneralAdaptorException e ){

//        }catch(NSException e){ // not thrown, EOGeneralAdaptorException
instead!
        EOEnterpriseObject failedEO;
        NSDictionary userInfo = (NSDictionary)e.userInfo();
// NSValidation.ValidationException catched above
//            String eName = (String)e.name();
//            //System.out.println("TolerantSaver: Exception occurred name:
"+ eName);
//            //System.out.println("Exception occurred e:
-------------------------");
//            //System.out.println("Exception occurred e: "+e);
//            //System.out.println("Exception occurred userInfo: "+
userInfo);
//            //System.out.println("Exception occurred e:
^^^^^^^^^^^^^^^^^^^^^^^^^");
//            if(eName.equals("EOValidationException")){
//                System.out.println("TolerantSaver: This is
EOValidationException");
//                //throw e;
//            }
...


Now it works like a charme.
Thanks dneumann!

Wolfram


> Take a look at "Update Strategies > Recovery" in the following document:
>
> http://developer.apple.com/documentation/WebObjects/
> Enterprise_Objects/index.html
>
> This gives a couple of solutions to these "Optimistic Locking"
> exceptions, including some sample code (note that there may be some
> errors in the sample code, but I think they are pretty easy to find
> and fix).
>
> On May 19, 2006, at 4:02 PM, Wolfram Stebel wrote:
>
>> Hi List,
>>
>> another problem i encounter today:
>>
>> i have two WO applications running, one uses objects from a
>> sharedEditingContext for display only.
>> In one method of this appication i added the following:
>>
>> ...
>> EOEditingContext localEC = new EOEditingContext ();
>> localEC.setSharedEditingContext ( null );
>> // wcSponsor comes in a shared EC so get a modifyable copy in local EC
>> WCSponsor copiedSponsor = ( WCSponsor ) localEC.faultForGlobalID (
>> wcSponsor.editingContext ().globalIDForObject ( wcSponsor ),
>> localEC );
>>
>> Integer hc = ( Integer ) copiedSponsor.hit_count();
>> copiedSponsor.setHit_count ( new Integer ( hc != null ? hc.intValue
>> () + 1 :
>> 1 ) );
>> localEC.saveChanges ();
>> ...
>>
>>
>> I get the following exception, when i try to save the same object
>> from the
>> second application after the above code updated the database:
>>
>> com.webobjects.eoaccess.EOGeneralAdaptorException:
>> updateValuesInRowDescribedByQualifier --
>> com.webobjects.jdbcadaptor.JDBCChannel method failed to update row in
>> database
>>
>> As far as i can see, this is a standard concurrency problem.
>> Now i tried TolerantSaver from dneumann to get the data merged and
>> saved.
>> But now i wonder, that this exception is not catched in there.
>>
>> Is TolerantSaver the wrong solution?
>>
>> What could i do instead?


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: method failed to update row (From: Robert Walker <email@hidden>)

  • Prev by Date: Re: Explaining the power of Direct to Web
  • Next by Date: Re: AJAX WebObjects Integration
  • Previous by thread: Re: method failed to update row
  • Next by thread: Total A Column Using Code
  • Index(es):
    • Date
    • Thread