PFB获取MySQLIntegrityConstraintViolationException的表关系:无法添加或更新子行:外键约束失败
@Entity
@Table(name = "CNT_CONTROL_INSTANCE")
public class ControlInstance {
/** Added Generator strategy */
@Id
@GeneratedValue(generator = "gen")
@GenericGenerator(name = "gen", strategy = "foreign", parameters =
@Parameter(name = "property", value = "variable"))
private Long id;
@OneToOne(fetch = LAZY, cascade = ALL)
@PrimaryKeyJoinColumn
private Variable variable;
@OneToOne(fetch = LAZY, cascade = ALL, mappedBy = "controlInstance")
private Attribute attribute;
}
@Entity
@Table(name = "DYF_ATTRIBUTE")
public class Attribute {
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn
private ControlInstance controlInstance;
}
请让我知道问题和解决方案?当我在mysql中检查时,两个表的自动增量计数器都没有同步。