queryTimeoutMapping.setSetMethodName("setQueryTimeout");
queryTimeoutMapping.setXPath(getPrimaryNamespaceXPath() + "timeout/text()");
queryTimeoutMapping.setNullValue(new Integer(DescriptorQueryManager.DefaultTimeout));
descriptor.addMapping(queryTimeoutMapping);
XMLCompositeObjectMapping insertQueryMapping = new XMLCompositeObjectMapping();
insertQueryMapping.setAttributeName("insertQuery");
insertQueryMapping.setGetMethodName("getInsertQuery");
insertQueryMapping.setSetMethodName("setInsertQuery");
insertQueryMapping.setXPath(getPrimaryNamespaceXPath() + "insert-query");
insertQueryMapping.setReferenceClass(InsertObjectQuery.class);
descriptor.addMapping(insertQueryMapping);
XMLCompositeObjectMapping updateQueryMapping = new XMLCompositeObjectMapping();
updateQueryMapping.setAttributeName("updateQuery");
updateQueryMapping.setGetMethodName("getUpdateQuery");
updateQueryMapping.setSetMethodName("setUpdateQuery");
updateQueryMapping.setXPath(getPrimaryNamespaceXPath() + "update-query");
updateQueryMapping.setReferenceClass(UpdateObjectQuery.class);
descriptor.addMapping(updateQueryMapping);
XMLCompositeObjectMapping deleteQueryMapping = new XMLCompositeObjectMapping();
deleteQueryMapping.setAttributeName("deleteQuery");
deleteQueryMapping.setGetMethodName("getDeleteQuery");
deleteQueryMapping.setSetMethodName("setDeleteQuery");
deleteQueryMapping.setXPath(getPrimaryNamespaceXPath() + "delete-query");
deleteQueryMapping.setReferenceClass(DeleteObjectQuery.class);
descriptor.addMapping(deleteQueryMapping);
XMLCompositeObjectMapping doesExistQueryMapping = new XMLCompositeObjectMapping();
doesExistQueryMapping.setAttributeName("doesExistQuery");
// Handle translation of default does-exist to null.
doesExistQueryMapping.setAttributeAccessor(new AttributeAccessor() {
public Object getAttributeValueFromObject(Object object) {
DoesExistQuery query = ((DescriptorQueryManager)object).getDoesExistQuery();
if ((!query.isCallQuery()) && query.shouldCheckCacheForDoesExist()) {
return null;
}
return query;
}
public void setAttributeValueInObject(Object object, Object value) {
DoesExistQuery query = (DoesExistQuery)value;
if (value == null) {
return;
}
((DescriptorQueryManager)object).setDoesExistQuery(query);
}
});
doesExistQueryMapping.setXPath(getPrimaryNamespaceXPath() + "does-exist-query");
doesExistQueryMapping.setReferenceClass(DoesExistQuery.class);
descriptor.addMapping(doesExistQueryMapping);
XMLCompositeObjectMapping readObjectQueryMapping = new XMLCompositeObjectMapping();
readObjectQueryMapping.setAttributeName("readObjectQuery");
readObjectQueryMapping.setGetMethodName("getReadObjectQuery");
readObjectQueryMapping.setSetMethodName("setReadObjectQuery");
readObjectQueryMapping.setXPath(getPrimaryNamespaceXPath() + "read-object-query");
readObjectQueryMapping.setReferenceClass(ReadObjectQuery.class);
descriptor.addMapping(readObjectQueryMapping);
XMLCompositeObjectMapping readAllQueryMapping = new XMLCompositeObjectMapping();
readAllQueryMapping.setAttributeName("readAllQuery");
readAllQueryMapping.setGetMethodName("getReadAllQuery");
readAllQueryMapping.setSetMethodName("setReadAllQuery");
readAllQueryMapping.setXPath(getPrimaryNamespaceXPath() + "read-all-query");
readAllQueryMapping.setReferenceClass(ReadAllQuery.class);
descriptor.addMapping(readAllQueryMapping);
return descriptor;
}