I can almost guarantee this is the problem.  :-)

Chuck


On Apr 4, 2007, at 9:56 AM, Ken Anderson wrote:

Frank,

Upon first glance, your code looks OK, except for the fact that you're not locking your editing context. Since you're allocating a new one, you need to lock it. I suggest you do this:

ec.lock();
try {
// current code
} finally {
ec.unlock();
}

Since your problem is intermittent, it is likely that this is the problem.

Ken


On Apr 4, 2007, at 12:45 PM, Frank Stock wrote:

Hi,

I use SOAP-calls to WO and I get strange effects in the following routine:

public void deleteWebtextValue (String webtext, String language) {
        
                EOEditingContext ec = new EOEditingContext();
                EOQualifier aQual;
                NSMutableArray qbind;
                EOFetchSpecification fs;
                
                LanguageWebtext lwObject;
                qbind=new NSMutableArray();
                qbind.addObject(webtext);
                qbind.addObject(language);
aQual = EOQualifier.qualifierWithQualifierFormat ("(webtext.webtext=%@) and (language.language=%@)",qbind);
                fs = new EOFetchSpecification("LanguageWebtext",aQual,null);
                NSArray arLanguageWebtext = 
ec.objectsWithFetchSpecification(fs);
                // should only be 1
                for (int i=0;i< arLanguageWebtext.count();i++) {
                        lwObject = 
(LanguageWebtext)arLanguageWebtext.objectAtIndex(i);
                        ec.deleteObject(lwObject);
                }
                ec.saveChanges();
                
        }

Most of the time this results in a delete-statement:
delete from languagewebtext where languagewebtext_id=8788;

but sometimes I get a (strange) update-statement:

update languagewebtext set language_id = NULL, webtext_id = NULL where languagewebtext_id=8898;
Both can't be NULL;
This results in currupting the database!

I don't understand that!


Thanks for helping,
Frank Stock
 _______________________________________________
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/kenlists% 40anderhome.com

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/chill% 40global-village.net

This email sent to [EMAIL PROTECTED]

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects





_______________________________________________
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