title: JPA: persisting object, parent is ok but child not updated
body: <p>I have my domain object, <code>Client</code>, I've got a form on my JSP that is pre-populated with its data, I can take in amended values, and persist the object.</p>
  
  <p><code>Client</code> has an abstract entity called <code>MarketResearch</code>, which is then extended by one of three more concrete sub-classes.</p>
  
  <p>I have a form to pre-populate some <code>MarketResearch</code> data, but when I make changes and try to persist the <code>Client</code>, it doesn't get saved, can someone give me some pointers on where I've gone wrong?</p>
  
  <p>My 3 domain classes are as follows (removed accessors etc)</p>
  
  <pre><code>public class Client extends NamedEntity
  {
      @OneToOne
      @JoinColumn(name = "MARKET_RESEARCH_ID")
      private MarketResearch marketResearch;
      ...
  }
  
  
  @Inheritance(strategy = InheritanceType.JOINED)
  public abstract class MarketResearch extends AbstractEntity
  {
    ...
  }
  
  @Entity(name="MARKETRESEARCHLG")
  public class MarketResearchLocalGovernment extends MarketResearch
  {
  
      @Column(name = "CURRENT_HR_SYSTEM")
      private String currentHRSystem;
      ...
  }
  </code></pre>
  
  <p>This is how I'm persisting</p>
  
  <pre><code>public void persistClient(Client client)
  {
      if (client.getId() != null)
      {
          getJpaTemplate().merge(client);
          getJpaTemplate().flush();
      } else
      {
          getJpaTemplate().persist(client);
      }
  }
  </code></pre>
  
  <p>To summarize, if I change something on the parent object, it persists, but if I change something on the child object it doesn't. Have I missed something blatantly obvious?</p>
  
  <p>I've put a breakpoint right before the persist/merge calls, I can see the updated value on the object, but it doesn't seem to save. I've checked at database level as well, no luck</p>
  
  <p>Thanks</p>