Re: method failed to update row

2006-05-20 Thread Wolfram Stebel
Am 19.05.2006 22:30 Uhr schrieb "Robert Walker" unter
<[EMAIL PROTECTED]>:

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  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: method failed to update row

2006-05-19 Thread Robert Walker

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?

Wolfram



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


method failed to update row

2006-05-19 Thread Wolfram Stebel
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?

Wolfram


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: how to get more details for "method failed to update row in database"

2006-01-10 Thread Dev WO
Hi Geoff,I removed the padlock from the only "suspicious" item and still have the same error.One thing to mention: on the exact same account, restarting the application resolve the issue, I mean the direct action works immediately after the restart...maybe this make you think about something;) I'm clueless:(XavierKeep an eye out for  data columns like floats, timestamps, blobs - if you have the 'padlock' set on these, you can sometimes get weirdness. Try unchecking the padlock in eomodeler on anything that looks like it may have a precision problem, see if that helps. HTHGeoffOn 10/01/06, Ken Anderson <[EMAIL PROTECTED]> wrote: Why is it doing a save if it's just checking?Since you are saving, you have a staleness problem - so it makessense that it only occurs some of the time.  Are you running multipleinstances?  Is your database being updated by anything outside of your application?If you answered yes to either question, you need to consider howyou're going to keep data up to date.  Chuck Hill (and others) havemade many useful posts on this subject if you look in the archives. The brute force way is to refresh your object(s) before you updatethem, but there's still the possibility of running into trouble witha stubborn contender.KenPS - I bcc'd the omnigroup list instead of replying all. On Jan 10, 2006, at 11:07 AM, Dev WO wrote:> Hi,> I'm having trouble debugging an issue:> I've got a direct action that would validate a member account.> So the method is simply checking the database to see if the email/ > account exists and if it is not already activated.>> But I end up with:> > com.webobjects.eoaccess.EOGeneralAdaptorException:> updateValuesInRowDescribedByQualifier --> com.webobjects.jdbcadaptor.JDBCChannel method failed to update row> in database>   at> com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContex> tInformationAdded(EODatabaseContext.java :4685)>   at com.webobjects.eoaccess.EODatabaseContext.performChanges> (EODatabaseContext.java:6393)>   at> com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditing> Context( EOObjectStoreCoordinator.java:415)>   at com.webobjects.eocontrol.EOEditingContext.saveChanges> (EOEditingContext.java:3226)>   at DirectAction.validateEmailAction(DirectAction.java:96)>  >> I have set EOAdaptorDebugEnabled=YES to check the SQL, and the SQL> is correct...> This doesn't happen every time, but time to time, so it's hard to> track it down.>> Any clue on how to find where it comes from would be greatly > appreciated:)>> Thanks>> Xavier> ___> Do not post admin requests to the list. They will be ignored.> Webobjects-dev mailing list  ( Webobjects-dev@lists.apple.com)> Help/Unsubscribe/Update your Subscription:> http://lists.apple.com/mailman/options/webobjects-dev/lists% > 40anderhome.com>> This email sent to [EMAIL PROTECTED] ___ Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/geoff.hopson%40gmail.comThis email sent to  [EMAIL PROTECTED] ___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40anazys.comThis email sent to [EMAIL PROTECTED]  ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: how to get more details for "method failed to update row in database"

2006-01-10 Thread Dev WO
Hi Ken,Why is it doing a save if it's just checking?I'm using the DA to activate the account (by setting a boolean to true) so that's why it saves.Since you are saving, you have a staleness problem - so it makes sense that it only occurs some of the time.  Are you running multiple instances?Sometimes, but very rarely. At least it happens now on my development machine, so only one instance was running.  Is your database being updated by anything outside of your application?this type of object (accounts) could be updated using another application, but I'm sure it wasn't for now.If you answered yes to either question, you need to consider how you're going to keep data up to date.  Chuck Hill (and others) have made many useful posts on this subject if you look in the archives.  The brute force way is to refresh your object(s) before you update them, but there's still the possibility of running into trouble with a stubborn contender.Actually I'm creating a dedicated EC to manage this direct action:=	public WOActionResults validateEmailAction(){        String email = (String)request().formValueForKey("email");        EOEditingContext emailEC = new EOEditingContext();		NSMutableArray args = new NSMutableArray();		args.addObject(email);		EOQualifier qual = EOQualifier.qualifierWithQualifierFormat("(email = %@) and (deletedOn = null)", args);		EOFetchSpecification spec = new EOFetchSpecification("Member",qual,null);		NSArray results = emailEC.objectsWithFetchSpecification(spec);		Main nextPage = (Main)pageWithName("Main");		if (results.count()==0){			nextPage.setDisplayString("le compte " + email + " n'existe pas!");			nextPage.setMessageBannerIsPositive(false);		}		else{			Member aMember = (Member)results.objectAtIndex(0);			if ((aMember.emailValid().booleanValue()) && ((!aMember.activation().booleanValue()) || (aMember.activation() == null))) {nextPage.setDisplayString("Votre compte " + aMember.email() + " a été désactivé par un administrateur");nextPage.setMessageBannerIsPositive(false);			}			if ((aMember.emailValid().booleanValue()) && (aMember.activation().booleanValue())) {nextPage.setDisplayString("Votre compte " + aMember.email() + " a déjà été activé");nextPage.setMessageBannerIsPositive(false);			}			if (!aMember.emailValid().booleanValue()){try {	aMember.setEmailValid(new Boolean(true));	aMember.setActivation(new Boolean(true));	emailEC.lock();	emailEC.saveChanges();	emailEC.unlock();	//ec.saveChanges();	EOEditingContext ec = session().defaultEditingContext();	Person aPerson = (Person)EOUtilities.localInstanceOfObject(ec, (Person)aMember);	emailEC.dispose();	//Person aPerson = (Person)aMember;	((Session)session()).setSessionPerson(aPerson);	nextPage.setDisplayString("Votre compte " + aPerson.email() + " vient d'être activé");	nextPage.setMessageBannerIsPositive(true);} catch (Exception e){	e.printStackTrace();}			}			}		return nextPage;    }=So I don't really know how come the update fails...Should I make everything will the EC is locked?XavierKenPS - I bcc'd the omnigroup list instead of replying all.On Jan 10, 2006, at 11:07 AM, Dev WO wrote: Hi,I'm having trouble debugging an issue:I've got a direct action that would validate a member account.So the method is simply checking the database to see if the email/account exists and if it is not already activated.But I end up with:com.webobjects.eoaccess.EOGeneralAdaptorException: updateValuesInRowDescribedByQualifier -- com.webobjects.jdbcadaptor.JDBCChannel method failed to update row in database	at com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextInformationAdded(EODatabaseContext.java:4685)	at com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:6393)	at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:415)	at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3226)	at DirectAction.validateEmailAction(DirectAction.java:96)I have set EOAdaptorDebugEnabled=YES to check the SQL, and the SQL is correct...This doesn't happen every time, but time to time, so it's hard to track it down.Any clue on how to find where it comes from would be greatly appreciated:)ThanksXavier___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/lists%40anderhome.comThis email sent to [EMAIL PROTECTED]   ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: how to get more details for "method failed to update row in database"

2006-01-10 Thread Geoff Hopson
Keep an eye out for  data columns like floats, timestamps, blobs - if you have the 'padlock' set on these, you can sometimes get weirdness. Try unchecking the padlock in eomodeler on anything that looks like it may have a precision problem, see if that helps.
HTHGeoffOn 10/01/06, Ken Anderson <[EMAIL PROTECTED]> wrote:
Why is it doing a save if it's just checking?Since you are saving, you have a staleness problem - so it makessense that it only occurs some of the time.  Are you running multipleinstances?  Is your database being updated by anything outside of
your application?If you answered yes to either question, you need to consider howyou're going to keep data up to date.  Chuck Hill (and others) havemade many useful posts on this subject if you look in the archives.
The brute force way is to refresh your object(s) before you updatethem, but there's still the possibility of running into trouble witha stubborn contender.KenPS - I bcc'd the omnigroup list instead of replying all.
On Jan 10, 2006, at 11:07 AM, Dev WO wrote:> Hi,> I'm having trouble debugging an issue:> I've got a direct action that would validate a member account.> So the method is simply checking the database to see if the email/
> account exists and if it is not already activated.>> But I end up with:> > com.webobjects.eoaccess.EOGeneralAdaptorException:> updateValuesInRowDescribedByQualifier --> 
com.webobjects.jdbcadaptor.JDBCChannel method failed to update row> in database>   at> com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContex> tInformationAdded(EODatabaseContext.java
:4685)>   at com.webobjects.eoaccess.EODatabaseContext.performChanges> (EODatabaseContext.java:6393)>   at> com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditing> Context(
EOObjectStoreCoordinator.java:415)>   at com.webobjects.eocontrol.EOEditingContext.saveChanges> (EOEditingContext.java:3226)>   at DirectAction.validateEmailAction(DirectAction.java:96)> 
>> I have set EOAdaptorDebugEnabled=YES to check the SQL, and the SQL> is correct...> This doesn't happen every time, but time to time, so it's hard to> track it down.>> Any clue on how to find where it comes from would be greatly
> appreciated:)>> Thanks>> Xavier> ___> Do not post admin requests to the list. They will be ignored.> Webobjects-dev mailing list  (
Webobjects-dev@lists.apple.com)> Help/Unsubscribe/Update your Subscription:> http://lists.apple.com/mailman/options/webobjects-dev/lists%
> 40anderhome.com>> This email sent to [EMAIL PROTECTED] ___
Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/geoff.hopson%40gmail.comThis email sent to 
[EMAIL PROTECTED]
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Re: how to get more details for "method failed to update row in database"

2006-01-10 Thread Ken Anderson

Why is it doing a save if it's just checking?

Since you are saving, you have a staleness problem - so it makes  
sense that it only occurs some of the time.  Are you running multiple  
instances?  Is your database being updated by anything outside of  
your application?


If you answered yes to either question, you need to consider how  
you're going to keep data up to date.  Chuck Hill (and others) have  
made many useful posts on this subject if you look in the archives.   
The brute force way is to refresh your object(s) before you update  
them, but there's still the possibility of running into trouble with  
a stubborn contender.


Ken

PS - I bcc'd the omnigroup list instead of replying all.

On Jan 10, 2006, at 11:07 AM, Dev WO wrote:


Hi,
I'm having trouble debugging an issue:
I've got a direct action that would validate a member account.
So the method is simply checking the database to see if the email/ 
account exists and if it is not already activated.


But I end up with:

com.webobjects.eoaccess.EOGeneralAdaptorException:  
updateValuesInRowDescribedByQualifier --  
com.webobjects.jdbcadaptor.JDBCChannel method failed to update row  
in database
	at  
com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContex 
tInformationAdded(EODatabaseContext.java:4685)
	at com.webobjects.eoaccess.EODatabaseContext.performChanges 
(EODatabaseContext.java:6393)
	at  
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditing 
Context(EOObjectStoreCoordinator.java:415)
	at com.webobjects.eocontrol.EOEditingContext.saveChanges 
(EOEditingContext.java:3226)

at DirectAction.validateEmailAction(DirectAction.java:96)


I have set EOAdaptorDebugEnabled=YES to check the SQL, and the SQL  
is correct...
This doesn't happen every time, but time to time, so it's hard to  
track it down.


Any clue on how to find where it comes from would be greatly  
appreciated:)


Thanks

Xavier
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/lists% 
40anderhome.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com


how to get more details for "method failed to update row in database"

2006-01-10 Thread Dev WO

Hi,
I'm having trouble debugging an issue:
I've got a direct action that would validate a member account.
So the method is simply checking the database to see if the email/ 
account exists and if it is not already activated.


But I end up with:

com.webobjects.eoaccess.EOGeneralAdaptorException:  
updateValuesInRowDescribedByQualifier --  
com.webobjects.jdbcadaptor.JDBCChannel method failed to update row in  
database
	at  
com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextI 
nformationAdded(EODatabaseContext.java:4685)
	at com.webobjects.eoaccess.EODatabaseContext.performChanges 
(EODatabaseContext.java:6393)
	at  
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingCo 
ntext(EOObjectStoreCoordinator.java:415)
	at com.webobjects.eocontrol.EOEditingContext.saveChanges 
(EOEditingContext.java:3226)

at DirectAction.validateEmailAction(DirectAction.java:96)


I have set EOAdaptorDebugEnabled=YES to check the SQL, and the SQL is  
correct...
This doesn't happen every time, but time to time, so it's hard to  
track it down.


Any clue on how to find where it comes from would be greatly  
appreciated:)


Thanks

Xavier
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com