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="SYS_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 ?
we are using persistence xsd and not orm.xml so no option to set cascade-on-delete and cascade-remove doesnot work .I have raised the same error in eclispelink forum , I found a workaround that by setting on delete cascade on source table in database works but not satisfied by clients .
I see this bug also opening in eclipslelink bugzilla. Please let me know if you have any ideas on it.