I keep getting this error:
Error saving identity in IdentityDaoImpl. Reason: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.domain.Identity.password
I’ve mapped 3 tables on a OneToOneToOne mapping basis.
User -> Account -> Identity
How I have it now, Identity extends Account and Account extends User.
Maybe I’m not mapping correctly. I find it a bit tricky because there’s 3 one to one relationships instead of 2…
What’s the correct way of doing this?
EDIT 1:
I’ve changed all my merge() methods to save() already but it didn’t fix the problem.
EDIT 2:
Here is a clean version of my entity:
@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;
}
}
Can we see how you define the password field on your entity? I guess you’re trying to save sth. with a password of
nulland this violates either an@NotNullor sth. likerequired=true