title: Hibernate OneToOneToOne Mapping
body: <p>I keep getting this error:</p>
  
  <pre><code>Error saving identity in IdentityDaoImpl. Reason: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.domain.Identity.password
  </code></pre>
  
  <p>I've mapped 3 tables on a OneToOneToOne mapping basis.</p>
  
  <p>User -> Account -> Identity</p>
  
  <p>How I have it now, Identity extends Account and Account extends User.</p>
  
  <p>Maybe I'm not mapping correctly. I find it a bit tricky because there's 3 one to one relationships instead of 2...</p>
  
  <p>What's the correct way of doing this?</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>I've changed all my merge() methods to save() already but it didn't fix the problem.</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Here is a clean version of my entity:</p>
  
  <pre><code>@Entity()
  @Table(name = "`user`")
  @Inheritance(strategy = InheritanceType.JOINED)
  @DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "type")
  @DiscriminatorValue("")
  public class User extends ActionSupport implements UserDetails, Serializable {
  
  private static final long serialVersionUID = -7480567862246640031L;
  private Integer ID;
  private String type;
  private String password;
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "ID")
  public Integer getID() {
      return ID;
  }
  
  public void setID(Integer ID) {
      this.ID = ID;
  }
  
  @Column(name = "type", nullable = false, unique = false, length = 255)
  public String getType() {
      return type;
  }
  
  public void setType(String type) {
      this.type = type;
  }
  
  @Override
  @Column(name = "password", nullable = false, length = 255)
  public String getPassword() {
      return password;
  }
  
  public void setPassword(String password) {
      this.password = password;
  }
  </code></pre>
  
  <p>}</p>