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?

Xavier


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._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:)

Thanks

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

This email sent to [EMAIL PROTECTED]



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

This email sent to [email protected]

Reply via email to