public void initializeBusDescriptor() { MWTableDescriptor descriptor = getBusDescriptor(); MWTable table = tableNamed("BUS"); descriptor.setPrimaryTable(table); try { descriptor.mapInheritedAttributesToRootMinusOne(); } catch (ClassNotFoundException ex) { throw new RuntimeException(ex); } descriptor.getCachingPolicy().setCacheType(MWCachingPolicy.CACHE_TYPE_FULL); // inheritance policy descriptor.addInheritancePolicy(); MWRelationalDescriptorInheritancePolicy inheritancePolicy = (MWRelationalDescriptorInheritancePolicy) descriptor.getInheritancePolicy(); inheritancePolicy.setReadSubclassesOnQuery(false); inheritancePolicy.setParentDescriptor(getFueledVehicleDescriptor()); // multi-table info policy descriptor.addMultiTableInfoPolicy(); MWTable fuelVehTable = tableNamed("FUEL_VEH"); descriptor.addAssociatedTable(fuelVehTable); // direct to field mapping addDirectMapping(descriptor, "description", table, "DESCRIP"); addDirectMapping(descriptor, "fuelType", fuelVehTable, "FUEL_TYP"); // direct collection mapping MWRelationalDirectCollectionMapping partNumbersMapping = (MWRelationalDirectCollectionMapping) addDirectMapping(descriptor, "partNumbers").asMWDirectCollectionMapping(); partNumbersMapping.setTargetTable(tableNamed("PARTNUMS")); partNumbersMapping.setDirectValueColumn(tableNamed("PARTNUMS").columnNamed("PART_NUM")); partNumbersMapping.setReference(tableNamed("PARTNUMS").referenceNamed("PARTNUMS_BUS")); partNumbersMapping.setUseNoIndirection(); descriptor.removeMappingForAttribute(descriptor.getMWClass().attributeNamedFromAll("id")); descriptor.removeMappingForAttribute(descriptor.getMWClass().attributeNamedFromAll("owner")); descriptor.removeMappingForAttribute( descriptor.getMWClass().attributeNamedFromAll("passengerCapacity")); descriptor.removeMappingForAttribute( descriptor.getMWClass().attributeNamedFromAll("fuelCapacity")); }