XMLDirectMapping javaTypeMapping = new XMLDirectMapping();
javaTypeMapping.setAttributeName("javaType");
javaTypeMapping.setXPath(getPrimaryNamespaceXPath() + "java-type/text()");
descriptor.addMapping(javaTypeMapping);
XMLCompositeObjectMapping databaseTypeMapping = new XMLCompositeObjectMapping();
databaseTypeMapping.setAttributeName("databaseTypeWrapper");
databaseTypeMapping.setAttributeAccessor(new AttributeAccessor() {
public Object getAttributeValueFromObject(Object object) {
PLSQLCollection collection = (PLSQLCollection)object;
DatabaseType type = collection.getNestedType();
return wrapType(type);
}
public void setAttributeValueInObject(Object object, Object value) {
PLSQLCollection collection = (PLSQLCollection)object;
DatabaseTypeWrapper type = (DatabaseTypeWrapper)value;
collection.setNestedType(type.getWrappedType());
}
});
databaseTypeMapping.setReferenceClass(DatabaseTypeWrapper.class);
databaseTypeMapping.setXPath("nested-type");
descriptor.addMapping(databaseTypeMapping);
return descriptor;
}