Delete Operation is not cascading When using Secondary Table

Certified Lead Developer
I am using single CDT mapping to two tables by using @Table and @Secondary Table.Insertion is working fine.
While Deleting the entity by passing primary key,the data is not getting deleted from DB.(org.hibernate.exception.ConstraintViolationException)
<xsd:appinfo source="appian.jpa">
                              @Table(name="emp")
                              @SecondaryTable(name="MoreInfo", pkJoinColumns=@PrimaryKeyJoinColumn(name="Id",referencedColumnName="empId"))
                    </xsd:appinfo>
.....
....
<xsd:element name="empId" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">@Id</xsd:appinfo>
</xsd:annotation>
</xsd:element>
....

OriginalPostID-237339

  Discussion posts and replies are publicly visible

Parents
  • @Ramanjaneyulu Thummala
    Documentation says, "Any CDT created through the Data Type Designer or uploaded via an XSD file automatically has the cascade attribute to ALL by default, so unless you have manually changed this setting, deleting a parent record of a CDT with this setting results in the deletion of the parent's child records."
    Please share what you are setting for "Data to Delete". Will try to help you based on that.
Reply
  • @Ramanjaneyulu Thummala
    Documentation says, "Any CDT created through the Data Type Designer or uploaded via an XSD file automatically has the cascade attribute to ALL by default, so unless you have manually changed this setting, deleting a parent record of a CDT with this setting results in the deletion of the parent's child records."
    Please share what you are setting for "Data to Delete". Will try to help you based on that.
Children
No Data