Persistence.xml entry:
<property
name="toplink.session.customizer"
value="mypackage.PrivateOwnedCustomizer"/>
Customizer Class :
package mypackage;
import
oracle.toplink.essentials.sessions.Session;
import oracle.toplink.essentials.mappings.OneToManyMapping;
/**
* PUBLIC:
* This interface is to allow extra
customization on a TopLink Session
*/
public
class PrivateOwnedCustomizer extends SessionCustomizer {
public void customize(Session session)
throws Exception {
RelationalDescriptor entityDescriptor =
(RelationalDescriptor)
session.getDescriptor(domainmodel.MyEntity.class);
OneToManyMapping mapping = (OneToManyMapping)entityDescriptor.getMappingForAttributeName("<propertyName>");
mapping.privateOwnedRelationship();
}
}
Hi all,
Hibernate has a cascade type named "delete-orphan" that will delete entities from the database that were removed from an entity's collection when it is persisted. I don't see an equivalent in JPA. I take it you just have to do it manually? Or, is there a TopLink extension that will do this?
Jon