inMemoryQueryIndirectionPolicyMapping.setAttributeName("inMemoryQueryIndirectionPolicy");
inMemoryQueryIndirectionPolicyMapping.setReferenceClass(InMemoryQueryIndirectionPolicy.class);
// Handle translation of default to null.
inMemoryQueryIndirectionPolicyMapping.setAttributeAccessor(new AttributeAccessor() {
public Object getAttributeValueFromObject(Object object) {
InMemoryQueryIndirectionPolicy policy = ((ObjectLevelReadQuery)object).getInMemoryQueryIndirectionPolicy();
if (policy.shouldThrowIndirectionException()) {
return null;
}
return policy;
}
public void setAttributeValueInObject(Object object, Object value) {
if (value == null) {
return;
}
InMemoryQueryIndirectionPolicy policy = (InMemoryQueryIndirectionPolicy)value;
((ObjectLevelReadQuery)object).setInMemoryQueryIndirectionPolicy(policy);
}
});
inMemoryQueryIndirectionPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "in-memory-querying");
descriptor.addMapping(inMemoryQueryIndirectionPolicyMapping);