0

私はこのエラーを受け取り続けます:

Error saving identity in IdentityDaoImpl. Reason: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.domain.Identity.password

OneToOneToOneマッピングベースで3つのテーブルをマッピングしました。

ユーザー->アカウント->ID

私が今持っている方法では、IdentityはAccountを拡張し、AccountはUserを拡張します。

たぶん私は正しくマッピングしていません。2つではなく3つの1対1の関係があるので、少し注意が必要です...

これを行う正しい方法は何ですか?

編集1:

すべてのmerge()メソッドをsave()に変更しましたが、問題は修正されませんでした。

編集2:

これが私のエンティティのクリーンバージョンです:

@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;
}

}

4

2 に答える 2

0

エンティティのパスワードフィールドをどのように定義するかわかりますか?私はあなたがsthを保存しようとしていると思います。のパスワードを使用するnullと、これはan@NotNullまたはsthのいずれかに違反します。お気に入りrequired=true

于 2012-06-04T13:29:26.337 に答える
0
Error saving identity in IdentityDaoImpl. Reason: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.domain.Identity.password

パスワードとタイプの両方のフィールドはnull許容falseです。例外は、nullにできないパスワードにnull値を挿入しようとしていることを明確に示しています。また、typeはnull値を受け入れません。

于 2012-06-04T14:02:53.227 に答える