Hibernate坚持认为,“ nfe_destinatario_id”列不是null
时。我试图将列重命名为“ nfe_destinatario_id_2”,但仍继续出现错误:错误:“ nfe_destinatario_id”列中的空值违反了非空约束
@Entity
@Table(name = "nfe_destinatario", schema = "public")
public class NFeDestinatario {
@Id
@Setter
@Size(max = 36)
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
private String id;
@OneToOne(mappedBy = "nFeDestinatario", cascade = CascadeType.ALL, orphanRemoval = true)
@XStreamAlias("enderDest")
private NFeEnderecoDestinatario endereco;
}
@Entity
@Table(name = "nfe_endereco_destinatario", schema = "public")
public class NFeEnderecoDestinatario {
@Id
@Setter
@Size(max = 36)
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
private String id;
@OneToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "nfe_destinatario_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private NFeDestinatario nFeDestinatario;
}