title: GWT RPC attribute empty
body: <p>In my GWT app, have to track changes made to my hibernate objects, so I have this simple POJO to transfer modifications to the server side, where they would be logged:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class ModifiedValueReference implements Serializable {
      private static final long serialVersionUID = 6144012539285913980L;
  
      private Serializable oldValue;
      private Serializable newValue;
  
      public ModifiedValueReference() {
          super();
      }
  
      public ModifiedValueReference(Serializable oldValue, Serializable newValue) {
          this();
          setOldValue(oldValue);
          setNewValue(newValue);
      }
  
      public Serializable getOldValue() {
          return oldValue;
      }
  
      public void setOldValue(Serializable oldValue) {
          this.oldValue = oldValue;
      }
  
      public Serializable getNewValue() {
          return newValue;
      }
  
      public void setNewValue(Serializable newValue) {
          this.newValue = newValue;
      }
  
  }
  </code></pre>
  
  <p>The attributes <code>oldValue</code> and <code>newValue</code> are of type <code>Serializable</code> so my Integers, Strings, Dates, and Booleans can be stored, as well as several other Hibernate objects.</p>
  
  <p>Tracking is achieved by using a special setter method that logs the modification (eg: by using <code>setFirstNameLog()</code> instead of <code>setFirstName()</code> below):</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Person {
  
      private String firstname;
  
      private Map&lt;String, ModifiedValueReference&gt; modifications = 
              new HashMap&lt;String, ModifiedValueReference&gt;(15);
  
      public void addModification(String key, Serializable oldValue, Serializable newValue) {
          if (key != null &amp;&amp; !key.isEmpty()) {
              modifications.put(key, 
                      new ModifiedValueReference(oldValue, newValue));
          }
      }
  
      public void setFirstnameLog(String firstname) {
          addModification("First Name", getFirstname(), firstname);
          setFirstname(firstname);
      }
  
      public void setFirstname(String firstname) {
          this.firstname = firstname;     
      }
      public String getFirstname() {
          return this.firstname;
      }
  }
  </code></pre>
  
  <p>When the <code>ModifiedValueReference</code> object reaches the server side via GWT RPC, the <code>oldValue</code> and <code>newValue</code> are empty! <strong>Why?</strong></p>
  
  <p>Those fields were filled with Strings on the client side. On the server side, they are not null, but empty Strings.</p>