Deletion of entity throwing foreign key constraint for unidirectional mapping [message #1862774] |
Fri, 29 December 2023 05:59 |
Sanjana C Messages: 31 Registered: December 2022 |
Member |
|
|
Hi ,
I have a unidirection one-to-one mapping as below . When deleting the parent entity, eclipselink throws error saying foreign key constraint child object found.
@OneToOne(targetEntity = SystemeImpl.class,fetch = FetchType.LAZY,orphanRemoval = true,cascade = CascadeType.ALL)
@JoinColumn(name="SY_ID", referencedColumnName = "id")
private ValueHolderInterface systeme;
public Clientsysteme getsysteme() {
return (this.systeme != null) ? (Systeme) this.systeme.getValue() : null;
}
public void setSysteme(Systeme systeme) {
SystemeImpl target = (SystemeImpl) systeme;
this.setSystemeImpl((SystemeImpl)systeme);
}
public void setSystemeImpl(SystemeImpl systeme) {
if (systeme != null) {
if (this.systeme != null) {
this.systeme.setValue(systeme);
} else {
this.systeme = new ValueHolder(systeme);
}
} else {
if (this.systeme != null) {
this.systeme.setValue(null);
}
}
}
When deleting the record in system table, it should automatically delete the records in child table but even after configuring cascade, orphan removal , error is thrown.
Error:
Internal Exception: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: Integritäts-Constraint (FAN_SY_FK) violation - child record found.
Could you please suggest me whether do i need to configure anything else ?
Thanks,
Sanjana
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02747 seconds