XMLDirectMapping cascadePolicyMapping = new XMLDirectMapping();
cascadePolicyMapping.setAttributeName("cascadePolicy");
cascadePolicyMapping.setGetMethodName("getCascadePolicy");
cascadePolicyMapping.setSetMethodName("setCascadePolicy");
ObjectTypeConverter cascadePolicyConverter = new ObjectTypeConverter();
cascadePolicyConverter.addConversionValue("none", Integer.valueOf(DatabaseQuery.NoCascading));
cascadePolicyConverter.addConversionValue("all", Integer.valueOf(DatabaseQuery.CascadeAllParts));
cascadePolicyConverter.addConversionValue("private", Integer.valueOf(DatabaseQuery.CascadePrivateParts));
cascadePolicyMapping.setConverter(cascadePolicyConverter);
cascadePolicyMapping.setNullValue(Integer.valueOf(DatabaseQuery.NoCascading));
cascadePolicyMapping.setXPath(getPrimaryNamespaceXPath() + "cascade-policy/text()");
descriptor.addMapping(cascadePolicyMapping);
XMLDirectMapping cacheUsageMapping = new XMLDirectMapping();
cacheUsageMapping.setAttributeName("cacheUsage");
cacheUsageMapping.setGetMethodName("getCacheUsage");
cacheUsageMapping.setSetMethodName("setCacheUsage");
cacheUsageMapping.setXPath(getPrimaryNamespaceXPath() + "cache-usage/text()");
ObjectTypeConverter cacheUsageConverter = new ObjectTypeConverter();
cacheUsageConverter.addConversionValue("exact-primary-key", Integer.valueOf(ObjectLevelReadQuery.CheckCacheByExactPrimaryKey));
cacheUsageConverter.addConversionValue("primary-key", Integer.valueOf(ObjectLevelReadQuery.CheckCacheByPrimaryKey));
cacheUsageConverter.addConversionValue("cache-only", Integer.valueOf(ObjectLevelReadQuery.CheckCacheOnly));
cacheUsageConverter.addConversionValue("cache-then-database", Integer.valueOf(ObjectLevelReadQuery.CheckCacheThenDatabase));
cacheUsageConverter.addConversionValue("conform", Integer.valueOf(ObjectLevelReadQuery.ConformResultsInUnitOfWork));
cacheUsageConverter.addConversionValue("none", Integer.valueOf(ObjectLevelReadQuery.DoNotCheckCache));
cacheUsageConverter.addConversionValue("use-descriptor-setting", Integer.valueOf(ObjectLevelReadQuery.UseDescriptorSetting));
cacheUsageMapping.setConverter(cacheUsageConverter);
cacheUsageMapping.setNullValue(Integer.valueOf(ObjectLevelReadQuery.UseDescriptorSetting));
descriptor.addMapping(cacheUsageMapping);
XMLDirectMapping lockModeMapping = new XMLDirectMapping();
lockModeMapping.setAttributeName("lockMode");
lockModeMapping.setGetMethodName("getLockMode");
lockModeMapping.setSetMethodName("setLockMode");
lockModeMapping.setXPath(getPrimaryNamespaceXPath() + "lock-mode/text()");
ObjectTypeConverter lockModeConverter = new ObjectTypeConverter();
lockModeConverter.addConversionValue("default", Short.valueOf(ObjectLevelReadQuery.DEFAULT_LOCK_MODE));
lockModeConverter.addConversionValue("lock", Short.valueOf(ObjectLevelReadQuery.LOCK));
lockModeConverter.addConversionValue("lock-no-wait", Short.valueOf(ObjectLevelReadQuery.LOCK_NOWAIT));
lockModeConverter.addConversionValue("none", Short.valueOf(ObjectLevelReadQuery.NO_LOCK));
lockModeMapping.setConverter(lockModeConverter);
lockModeMapping.setNullValue(Short.valueOf(ObjectLevelReadQuery.DEFAULT_LOCK_MODE));
descriptor.addMapping(lockModeMapping);
XMLDirectMapping distinctStateMapping = new XMLDirectMapping();
distinctStateMapping.setAttributeName("distinctState");
distinctStateMapping.setGetMethodName("getDistinctState");
distinctStateMapping.setSetMethodName("setDistinctState");
distinctStateMapping.setXPath(getPrimaryNamespaceXPath() + "distinct-state/text()");
ObjectTypeConverter distinctStateConverter = new ObjectTypeConverter();
distinctStateConverter.addConversionValue("dont-use-distinct", Short.valueOf(ObjectLevelReadQuery.DONT_USE_DISTINCT));
distinctStateConverter.addConversionValue("none", Short.valueOf(ObjectLevelReadQuery.UNCOMPUTED_DISTINCT));
distinctStateConverter.addConversionValue("use-distinct", Short.valueOf(ObjectLevelReadQuery.USE_DISTINCT));
distinctStateMapping.setConverter(distinctStateConverter);
distinctStateMapping.setNullValue(Short.valueOf(ObjectLevelReadQuery.UNCOMPUTED_DISTINCT));
descriptor.addMapping(distinctStateMapping);
XMLCompositeObjectMapping inMemoryQueryIndirectionPolicyMapping = new XMLCompositeObjectMapping();