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);