Specifying Advanced Features by Amending the Descriptor

One-to-one target objects mapped as Privately Owned are, by default, verified before deletion or update outside of a unit of work.

Verification is a check for the previous value of the target and is accomplished through joining the source and target tables. Inside a unit of work, verification is accomplished by obtaining the previous value from the back-up clone, so this setting is not used because a database read is not required. You may wish to disable verification outside of a unit of work for performance reasons and can do so by sending the setShouldVerifyDelete() message to the mapping in an amendment method written for the descriptor, as follows:

public static void addToDescriptor(Descriptor descriptor){
//Find the one-to-one mapping for the address attribute
OneToOneMapping addressMapping=(OneToOneMapping) descriptor.getMappingForAttributeName("address");
addressMapping.setShouldVerifyDelete(false);
}


Related Topics

About CMP EJB Mappings
Working with CMR Relationship Mappings
Working with One-to-One Mappings

Creating One-to-One Mappings

 

Copyright © 1997, 2004, Oracle. All rights reserved.