Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6681021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:32:34+00:00 2026-05-26T04:32:34+00:00

In a GWT app I present items that can be edited by users. Loading

  • 0

In a GWT app I present items that can be edited by users. Loading and saving the items is perfomed by using the GWT request factory. What I now want to achive is if two users concurrently edit an item that the user that saves first wins in the fashion of optimistic concurrency control. Meaning that when the second user saves his changes the request factory backend recognizes that the version or presence of the item stored in the backend has changed since it has been transfered to the client and the request factory/backend then somehow prevents the items from being updated/saved.

I tried to implement this in the service method that is used to save the items but this will not work because request factory hands in the items just retrieved from the backend with applied user’s changes meaning the versions of these items are the current versions from the backend and a comparison pointless.

Are there any hooks in the request factory processing I coud leverage to achieve the requested behaviour? Any other ideas? Or do I have to use GWT-RPC instead…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:32:35+00:00Added an answer on May 26, 2026 at 4:32 am

    No: http://code.google.com/p/google-web-toolkit/issues/detail?id=6046

    Until the proposed API is implemented (EntityLocator, in comment #1, but it’s not clear to me how the version info could be reconstructed from its serialized form), you’ll have to somehow send the version back to the server.
    As I said in the issue, this cannot be done by simply making the version property available in the proxy and setting it; but you could add another property: getting it would always return null (or similar nonexistent value), so that setting it on the client-side to the value of the “true” version property would always produce a change, which guaranties the value will be sent to the server as part of the “property diff”; and on the server-side, you could handle things either in the setter (when RequestFactory applies the “property diff” and calls the setter, if the value is different from the “true” version, then throw an exception) or in the service methods (compare the version sent from the client –which you’d get from a different getter than the one mapped on the client, as that one must always return null– to the “true” version of the object, and raise an error if they don’t match).

    Something like:

    @ProxyFor(MyEntity.class)
    interface MyEntityProxy extends EntityProxy {
       String getServerVersion();
       String getClientVersion();
       void setClientVersion(String clientVersion);
       …
    }
    
    @Entity
    class MyEntity {
       private String clientVersion;
       @Version private String serverVersion;
    
       public String getServerVersion() { return serverVersion; }
       public String getClientVersion() { return null; }
       public void setClientVersion(String clientVersion) {
          this.clientVersion = clientVersion;
       }
    
       public void checkVersion() {
          if (Objects.equal(serverVersion, clientVersion)) {
             throw new OptimisticConcurrencyException();
          }
       }
    }
    

    Note that I haven’t tested this, this is pure theory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a GWT app that's using Google Maps. I'm trying to add
I'm creating a GWT app in Google App Engine, and using Google data store.
I have a GWT app that makes an RPC call to a server to
I'm using the gwt visualization library to display motion charts in a gwt app.
So, I'm using google datastore for my GWT app and my coworker came up
I am planning a web app using GWT. How well will it be supported
How can I develop 'Search Engine Friendly' web app in GWT? Take an example
I try to deploy a GWT application, to Google App Engine using NetBeans. I
We have a GWT app that has multiple screens, based off of a menu.
We have a gwt app that uses jcifs to pull the user name from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.