title: JSF - How to get old and new value when using Primefaces RowEditEvent?
body: <p>I have a datatable with 2 columns(name and description) and I want to update my database when a person updates a row and clicks the checkmark which triggers the <code>execBacking.update</code> method. </p>
  
  <p>In this method, I get the new values by casting <code>event.getObject()</code>, but how can i also get the old values? The name is my primary key so i need the old value to know which row to update in the db.</p>
  
  <p>xhtml page
      </p>
  
  <pre><code>  &lt;p:ajax event="rowEdit" listener="#{execBacking.update}" update=":execForm:execMessages" /&gt; 
  
    &lt;p:column headerText="Name"&gt;
      &lt;p:cellEditor&gt;
          &lt;f:facet name="output"&gt;
              &lt;h:outputText value="#{exec.name}" /&gt;
          &lt;/f:facet&gt;
          &lt;f:facet name="input"&gt;
              &lt;h:inputText value="#{exec.name}" /&gt;
          &lt;/f:facet&gt;
      &lt;/p:cellEditor&gt;
    &lt;/p:column&gt;
  
    &lt;p:column headerText="Description"&gt;
      &lt;p:cellEditor&gt;
          &lt;f:facet name="output"&gt;
              &lt;h:outputText value="#{exec.description}" /&gt;
          &lt;/f:facet&gt;
          &lt;f:facet name="input"&gt;
              &lt;h:inputText value="#{exec.description}" /&gt;
          &lt;/f:facet&gt;
      &lt;/p:cellEditor&gt;
    &lt;/p:column&gt;
  
    &lt;p:column headerText="Actions"&gt;
      &lt;p:rowEditor /&gt;
      &lt;p:commandLink styleClass="ui-icon ui-icon-trash" type="submit" actionListener="#{execBacking.delete}" update=":execForm:execMessages" &gt;
              &lt;f:attribute name="execName" value="#{exec.name}" /&gt;
          &lt;/p:commandLink&gt;
    &lt;/p:column&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>Backing bean</p>
  
  <pre><code>public void update(RowEditEvent event) {
  
          Dao dao = new Dao(ds);
          Exec exec = (Exec) event.getObject();
          System.out.println("name = "+exec.getName());  //New name
          System.out.println("desc = "+exec.getDescription());  //New desc
          try {
              // If the new exec was updated successfully
              if(dao.updateExec(accessBacking.getUsername(), null, exec.getName(), exec.getDescription())) {
                  FacesContext.getCurrentInstance().addMessage("growl", new FacesMessage(FacesMessage.SEVERITY_INFO, "Success", "Exec Updated Successfully!"));
              } else {
                  FacesContext.getCurrentInstance().addMessage("messages", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Error Updating Exec!"));
              }
          } catch (Exception e) {
              FacesContext.getCurrentInstance().addMessage("messages", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", e.getMessage()));
          }
      }
  </code></pre>