• 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
Refresh Causes Database Update
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Refresh Causes Database Update


  • Subject: Refresh Causes Database Update
  • From: Drew Thoeni <email@hidden>
  • Date: Sun, 22 Apr 2007 21:26:17 -0400

I have some code (below) that functions as expected. However, I just noticed when the user has completed this method, and is returned to the nextPage, if they refresh the nextPage the database is updated again with the same selections that were made in this method.

I'm pretty sure this is something I'm doing incorrectly. And am hoping it's obvious to you long-timers. Thoughts? (Other comments on my code is also, always, welcome.)

Regards,

Drew

To make the code easier to read, this is a review site. An item has many reviews. The method here is recording if someone found the review in question useful, not useful, or didn't vote.

    private Session session = (Session)session();
    private EOEditingContext ec = session().defaultEditingContext();

<snip>

    public BrowseReviewPage returnToBrowseReviewPage() {
if ( null != usefulRating ) { // user didn't rate if this review was useful.
    if ( usefulRating.intValue() == 1 ) {
reviewItem().setUsefulTotalVoteCount( new Integer( reviewItem().usefulTotalVoteCount().intValue() + 1 ) );
reviewItem().setUsefulPositiveVoteCount( new Integer( reviewItem().usefulPositiveVoteCount().intValue() + 1 ) );
    }
    if ( usefulRating.intValue() == 2 ) {
reviewItem().setUsefulTotalVoteCount( new Integer( reviewItem().usefulTotalVoteCount().intValue() + 1 ) );
    }
}
ec.saveChanges();
BrowseReviewPage nextPage = ( BrowseReviewPage )pageWithName( "BrowseReviewPage" );
nextPage.passObjects( reviewItem().toItem() );
return nextPage;
    }

 _______________________________________________
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: Refresh Causes Database Update
      • From: Guido Neitzer <email@hidden>
  • Prev by Date: Re: Snapshot problems SOLVED, FOR REAL, NO JOKE
  • Next by Date: Re: Refresh Causes Database Update
  • Previous by thread: Re: Snapshot problems SOLVED, FOR REAL, NO JOKE
  • Next by thread: Re: Refresh Causes Database Update
  • Index(es):
    • Date
    • Thread