hibernate - JPA 2.0 orphanRemoval=true VS on delete Cascade -
i little confused jpa 2.0 orphanremoval attribute.
i think can see needed when use jpa provider's db generation tools create underlying database ddl have on delete cascade on particular relation.
however, if db exists , has on delete cascade on relation, not enough cascade deletion appropriately? orphanremoval in addition?
cheers
orphanremoval has nothing on delete cascade.
orphanremoval entirely orm-specific thing. marks "child" entity removed when it's no longer referenced "parent" entity, e.g. when remove child entity corresponding collection of parent entity.
on delete cascade database-specific thing, deletes "child" row in database when "parent" row deleted.
Comments
Post a Comment