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

Database non updating


  • Subject: Database non updating
  • From: Amedeo Mantica <email@hidden>
  • Date: Thu, 18 Jan 2007 12:00:48 +0100

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:

This email sent to email@hidden

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

  • Prev by Date: RE: OPENBASE and Deadlocks -> follow-up
  • Next by Date: Re: WebServices Material on Wiki
  • Previous by thread: Re: OPENBASE and Deadlocks
  • Next by thread: Re: Database non updating
  • Index(es):
    • Date
    • Thread