• 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: Database non updating
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Database non updating


  • Subject: Re: Database non updating
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 18 Jan 2007 10:33:27 -0800

Hi Amedeo,

As Art said, this is a defect in your code, not a bug in EOF. Have you perhaps overridden setAuthorization so that it does not call super / willChange()? If so, EOF can't see the update. That would be my first suspicion.

Second, have you violated any of these anywhere in your code?
http://en.wikibooks.org/wiki/Programming:WebObjects/EOF/Using_EOF/ The_EOF_Commandments
Annoy EOF and it will annoy you! ;-)


Finally, try this:
theRecipient.authorize(); //THIS SIMPLY CHANGE A COLUMNS VALUE, SEE CODE BELOW
NSLog.out.appendln("Updates to be saved: " + ec.updatedObjects());
ec.saveChanges(); //ABSOLUTELY DON'T WORK ! RECORD ARE NOT UPDATED



Chuck



On Jan 18, 2007, at 3:00 AM, Amedeo Mantica wrote:

hi

I have a Table in my Database called Recipient, in that table is stored a list of potential newsletter recipients
the website admin can send throug website a mail to a person in the list asking for his authorization to receive newsletter.
the email contain tho links: one for accepting authorization and one other for denying, both are DirectActions.
The deny action works perfectly, the :


here my code:

public WOActionResults removeSubscriptionAction() { //DENY ACTION

String code = (String)request().formValueForKey("code");

if ( ( code != null ) && ( code.length() > 2 ) ) {

submissionResult nextPage = (submissionResult)pageWithName ("submissionResult");
nextPage.setCode(new Integer(code).intValue()); //code is used for search the user in database
nextPage.setConfirmation(false);
return nextPage;

} else {

//CODE FOR RETURNING TO HOME PAGE


		}
    }


public WOActionResults confirmAuthorizationAction() { //AUTHORIZE ACTION

String code = (String)request().formValueForKey("code");

if ( ( code != null ) && ( code.length() > 2 ) ) {

submissionResult nextPage = (submissionResult)pageWithName ("submissionResult");
nextPage.setCode(new Integer(code).intValue()); //code is used for search the user in database
nextPage.setConfirmation(true);
return nextPage;

} else {

//CODE FOR RETURNING TO HOME PAGE

}
}


the submissionResult code:

	public void appendToResponse(WOResponse response, WOContext context)
	{
		EOEditingContext ec=session().defaultEditingContext();
		EOFetchSpecification fetchSpec;

NSMutableDictionary dict = new NSMutableDictionary();
dict.takeValueForKey(code,"code");

fetchSpec = new EOFetchSpecification().fetchSpecificationNamed ("authorizingRecipient","Recipient");
fetchSpec = fetchSpec.fetchSpecificationWithQualifierBindings(dict);
recipientList = ec.objectsWithFetchSpecification(fetchSpec);

System.out.println("session="+this.hasSession());

if ( ( recipientList != null ) && ( recipientList.count() == 1 ) && confirmation ) {

System.out.println("AUTHORIZING");
theRecipient = (Recipient)recipientList.objectAtIndex(0);
theRecipient.authorize(); //THIS SIMPLY CHANGE A COLUMNS VALUE, SEE CODE BELOW
ec.saveChanges(); //ABSOLUTELY DON'T WORK ! RECORD ARE NOT UPDATED
}

if ( ( recipientList != null ) && ( recipientList.count() == 1 ) && !confirmation ) {

System.out.println("DELETING");
theRecipient = (Recipient)recipientList.objectAtIndex(0);
ec.deleteObject(theRecipient);
ec.saveChanges(); //THIS CODE WORKS PERFECTLY, RECORD IS DELETED
}


		super.appendToResponse(response, context);
	}


Recipient class authorize() method

	public void authorize() {
		setAuthorization(new Integer(1));
	}


Now I'm thinking on a workaround based on direct SQL command, but I would like to know why this is not working.
Tha database engine is openbase.
Thank you for support


Amedeo Mantica
http://www.se30.it
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden

--

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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Database non updating
      • From: Amedeo Mantica <email@hidden>
References: 
 >OPENBASE and Deadlocks (From: Andrew Lindesay <email@hidden>)
 >Re: OPENBASE and Deadlocks (From: Scott Keith <email@hidden>)
 >Database non updating (From: Amedeo Mantica <email@hidden>)

  • Prev by Date: Re: Database non updating
  • Next by Date: Re: WebServices Material on Wiki
  • Previous by thread: Re: Database non updating
  • Next by thread: Re: Database non updating
  • Index(es):
    • Date
    • Thread