XMLDirectMapping descriptorTypeMapping = new XMLDirectMapping();
descriptorTypeMapping.setAttributeName("descriptorTypeValue");
descriptorTypeMapping.setGetMethodName("getDescriptorTypeValue");
descriptorTypeMapping.setSetMethodName("setDescriptorTypeValue");
ObjectTypeConverter descriptorTypeConverter = new ObjectTypeConverter();
descriptorTypeConverter.addConversionValue("aggregate", "Aggregate");
descriptorTypeConverter.addConversionValue("aggregate-collection", "Aggregate collection");
descriptorTypeConverter.addConversionValue("composite", "Composite");
descriptorTypeConverter.addConversionValue("composite-collection", "Composite collection");
descriptorTypeConverter.addConversionValue("interface", "Interface");
descriptorTypeConverter.addConversionValue("independent", "Normal");
descriptorTypeMapping.setConverter(descriptorTypeConverter);
descriptorTypeMapping.setXPath(getPrimaryNamespaceXPath() + "descriptor-type/text()");
descriptor.addMapping(descriptorTypeMapping);
XMLCompositeObjectMapping interfacePolicyMapping = new XMLCompositeObjectMapping();
interfacePolicyMapping.setAttributeName("interfacePolicy");
interfacePolicyMapping.setGetMethodName("getInterfacePolicyOrNull");
interfacePolicyMapping.setSetMethodName("setInterfacePolicy");
interfacePolicyMapping.setReferenceClass(InterfacePolicy.class);
interfacePolicyMapping.setXPath(getPrimaryNamespaceXPath() + "interfaces");
descriptor.addMapping(interfacePolicyMapping);
XMLCompositeObjectMapping lockingPolicyMapping = new XMLCompositeObjectMapping();
lockingPolicyMapping.setAttributeName("lockingPolicy");
lockingPolicyMapping.setGetMethodName("getOptimisticLockingPolicy");
lockingPolicyMapping.setSetMethodName("setOptimisticLockingPolicy");
lockingPolicyMapping.setReferenceClass(VersionLockingPolicy.class);
lockingPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "locking");
descriptor.addMapping(lockingPolicyMapping);
XMLDirectMapping sequenceNameMapping = new XMLDirectMapping();
sequenceNameMapping.setAttributeName("sequenceNumberName");
sequenceNameMapping.setGetMethodName("getSequenceNumberName");
sequenceNameMapping.setSetMethodName("setSequenceNumberName");
sequenceNameMapping.setXPath(getPrimaryNamespaceXPath() + "sequencing/" + getPrimaryNamespaceXPath() + "sequence-name/text()");
descriptor.addMapping(sequenceNameMapping);
XMLCompositeObjectMapping sequenceFieldMapping = new XMLCompositeObjectMapping();
sequenceFieldMapping.setAttributeName("sequenceNumberField");
sequenceFieldMapping.setGetMethodName("getSequenceNumberField");
sequenceFieldMapping.setSetMethodName("setSequenceNumberField");
sequenceFieldMapping.setReferenceClass(DatabaseField.class);
sequenceFieldMapping.setXPath(getPrimaryNamespaceXPath() + "sequencing/" + getPrimaryNamespaceXPath() + "sequence-field");
descriptor.addMapping(sequenceFieldMapping);
XMLDirectMapping identityMapClassMapping = new XMLDirectMapping();
identityMapClassMapping.setAttributeName("identityMapClass");
identityMapClassMapping.setGetMethodName("getIdentityMapClass");
identityMapClassMapping.setSetMethodName("setIdentityMapClass");
ObjectTypeConverter identityMapClassConverter = new ObjectTypeConverter();
identityMapClassConverter.addConversionValue("none", NoIdentityMap.class);
identityMapClassConverter.addConversionValue("full", FullIdentityMap.class);
identityMapClassConverter.addConversionValue("cache", CacheIdentityMap.class);
identityMapClassConverter.addConversionValue("weak-reference", WeakIdentityMap.class);
identityMapClassConverter.addConversionValue("soft-cache-weak-reference", SoftCacheWeakIdentityMap.class);
identityMapClassConverter.addConversionValue("hard-cache-weak-reference", HardCacheWeakIdentityMap.class);
identityMapClassMapping.setConverter(identityMapClassConverter);
identityMapClassMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-type/text()");
identityMapClassMapping.setNullValue(SoftCacheWeakIdentityMap.class);
descriptor.addMapping(identityMapClassMapping);
XMLDirectMapping remoteIdentityMapClassMapping = new XMLDirectMapping();
remoteIdentityMapClassMapping.setAttributeName("remoteIdentityMapClass");
remoteIdentityMapClassMapping.setGetMethodName("getRemoteIdentityMapClass");
remoteIdentityMapClassMapping.setSetMethodName("setRemoteIdentityMapClass");
ObjectTypeConverter remoteIdentityMapClassConverter = new ObjectTypeConverter();
remoteIdentityMapClassConverter.addConversionValue("none", NoIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("full", FullIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("cache", CacheIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("weak-reference", WeakIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("soft-cache-weak-reference", SoftCacheWeakIdentityMap.class);
remoteIdentityMapClassConverter.addConversionValue("hard-cache-weak-reference", HardCacheWeakIdentityMap.class);
remoteIdentityMapClassMapping.setConverter(remoteIdentityMapClassConverter);
remoteIdentityMapClassMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "cache-type/text()");
remoteIdentityMapClassMapping.setNullValue(SoftCacheWeakIdentityMap.class);
descriptor.addMapping(remoteIdentityMapClassMapping);
XMLDirectMapping identityMapSizeMapping = new XMLDirectMapping();
identityMapSizeMapping.setAttributeName("identityMapSize");
identityMapSizeMapping.setGetMethodName("getIdentityMapSize");
identityMapSizeMapping.setSetMethodName("setIdentityMapSize");
identityMapSizeMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-size/text()");
identityMapSizeMapping.setNullValue(new Integer(100));
descriptor.addMapping(identityMapSizeMapping);
XMLDirectMapping remoteIdentityMapSizeMapping = new XMLDirectMapping();
remoteIdentityMapSizeMapping.setAttributeName("remoteIdentityMapSize");
remoteIdentityMapSizeMapping.setGetMethodName("getRemoteIdentityMapSize");
remoteIdentityMapSizeMapping.setSetMethodName("setRemoteIdentityMapSize");
remoteIdentityMapSizeMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "cache-size/text()");
remoteIdentityMapSizeMapping.setNullValue(new Integer(100));
descriptor.addMapping(remoteIdentityMapSizeMapping);
XMLDirectMapping shouldAlwaysRefreshCacheMapping = new XMLDirectMapping();
shouldAlwaysRefreshCacheMapping.setAttributeName("shouldAlwaysRefreshCache");
shouldAlwaysRefreshCacheMapping.setGetMethodName("shouldAlwaysRefreshCache");
shouldAlwaysRefreshCacheMapping.setSetMethodName("setShouldAlwaysRefreshCache");
shouldAlwaysRefreshCacheMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "always-refresh/text()");
shouldAlwaysRefreshCacheMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldAlwaysRefreshCacheMapping);
XMLDirectMapping shouldAlwaysRefreshCacheOnRemoteMapping = new XMLDirectMapping();
shouldAlwaysRefreshCacheOnRemoteMapping.setAttributeName("shouldAlwaysRefreshCacheOnRemote");
shouldAlwaysRefreshCacheOnRemoteMapping.setGetMethodName("shouldAlwaysRefreshCacheOnRemote");
shouldAlwaysRefreshCacheOnRemoteMapping.setSetMethodName("setShouldAlwaysRefreshCacheOnRemote");
shouldAlwaysRefreshCacheOnRemoteMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "always-refresh/text()");
shouldAlwaysRefreshCacheOnRemoteMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldAlwaysRefreshCacheOnRemoteMapping);
XMLDirectMapping shouldOnlyRefreshCacheIfNewerVersionMapping = new XMLDirectMapping();
shouldOnlyRefreshCacheIfNewerVersionMapping.setAttributeName("shouldOnlyRefreshCacheIfNewerVersion");
shouldOnlyRefreshCacheIfNewerVersionMapping.setGetMethodName("shouldOnlyRefreshCacheIfNewerVersion");
shouldOnlyRefreshCacheIfNewerVersionMapping.setSetMethodName("setShouldOnlyRefreshCacheIfNewerVersion");
shouldOnlyRefreshCacheIfNewerVersionMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "only-refresh-cache-if-newer-version/text()");
shouldOnlyRefreshCacheIfNewerVersionMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldOnlyRefreshCacheIfNewerVersionMapping);
XMLDirectMapping shouldDisableCacheHitsMapping = new XMLDirectMapping();
shouldDisableCacheHitsMapping.setAttributeName("shouldDisableCacheHits");
shouldDisableCacheHitsMapping.setGetMethodName("shouldDisableCacheHits");
shouldDisableCacheHitsMapping.setSetMethodName("setShouldDisableCacheHits");
shouldDisableCacheHitsMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "disable-cache-hits/text()");
shouldDisableCacheHitsMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldDisableCacheHitsMapping);
XMLDirectMapping shouldDisableCacheHitsOnRemoteMapping = new XMLDirectMapping();
shouldDisableCacheHitsOnRemoteMapping.setAttributeName("shouldDisableCacheHitsOnRemote");
shouldDisableCacheHitsOnRemoteMapping.setGetMethodName("shouldDisableCacheHitsOnRemote");
shouldDisableCacheHitsOnRemoteMapping.setSetMethodName("setShouldDisableCacheHitsOnRemote");
shouldDisableCacheHitsOnRemoteMapping.setXPath(getPrimaryNamespaceXPath() + "remote-caching/" + getPrimaryNamespaceXPath() + "disable-cache-hits/text()");
shouldDisableCacheHitsOnRemoteMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldDisableCacheHitsOnRemoteMapping);
XMLDirectMapping shouldAlwaysConformResultsInUnitOfWorkMapping = new XMLDirectMapping();
shouldAlwaysConformResultsInUnitOfWorkMapping.setAttributeName("shouldAlwaysConformResultsInUnitOfWork");
shouldAlwaysConformResultsInUnitOfWorkMapping.setGetMethodName("shouldAlwaysConformResultsInUnitOfWork");
shouldAlwaysConformResultsInUnitOfWorkMapping.setSetMethodName("setShouldAlwaysConformResultsInUnitOfWork");
shouldAlwaysConformResultsInUnitOfWorkMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "always-conform/text()");
shouldAlwaysConformResultsInUnitOfWorkMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(shouldAlwaysConformResultsInUnitOfWorkMapping);
XMLDirectMapping isIsolatedMapping = new XMLDirectMapping();
isIsolatedMapping.setAttributeName("isIsolated");
isIsolatedMapping.setGetMethodName("isIsolated");
isIsolatedMapping.setSetMethodName("setIsIsolated");
isIsolatedMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "isolated/text()");
isIsolatedMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(isIsolatedMapping);
XMLDirectMapping unitOfWorkCacheIsolationLevelMapping = new XMLDirectMapping();
unitOfWorkCacheIsolationLevelMapping.setAttributeName("unitOfWorkCacheIsolationLevel");
unitOfWorkCacheIsolationLevelMapping.setGetMethodName("getUnitOfWorkCacheIsolationLevel");
unitOfWorkCacheIsolationLevelMapping.setSetMethodName("setUnitOfWorkCacheIsolationLevel");
unitOfWorkCacheIsolationLevelMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "unitofwork-isolation-level/text()");
ObjectTypeConverter unitOfWorkCacheIsolationLevelConverter = new ObjectTypeConverter();
unitOfWorkCacheIsolationLevelConverter.addConversionValue("use-session-cache-after-transaction", new Integer(ClassDescriptor.USE_SESSION_CACHE_AFTER_TRANSACTION));
unitOfWorkCacheIsolationLevelConverter.addConversionValue("isolate-new-data-after-transaction", new Integer(ClassDescriptor.ISOLATE_NEW_DATA_AFTER_TRANSACTION));
unitOfWorkCacheIsolationLevelConverter.addConversionValue("isolate-cache-after-transaction", new Integer(ClassDescriptor.ISOLATE_CACHE_AFTER_TRANSACTION));
unitOfWorkCacheIsolationLevelConverter.addConversionValue("isolate-cache-always", new Integer(ClassDescriptor.ISOLATE_CACHE_ALWAYS));
unitOfWorkCacheIsolationLevelMapping.setConverter(unitOfWorkCacheIsolationLevelConverter);
unitOfWorkCacheIsolationLevelMapping.setNullValue(new Integer(ClassDescriptor.ISOLATE_NEW_DATA_AFTER_TRANSACTION));
descriptor.addMapping(unitOfWorkCacheIsolationLevelMapping);
XMLCompositeObjectMapping cacheInvalidationPolicyMapping = new XMLCompositeObjectMapping();
cacheInvalidationPolicyMapping.setAttributeName("cacheInvalidationPolicy");
cacheInvalidationPolicyMapping.setReferenceClass(CacheInvalidationPolicy.class);
cacheInvalidationPolicyMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-invalidation-policy");
descriptor.addMapping(cacheInvalidationPolicyMapping);
XMLDirectMapping cacheSyncTypeMapping = new XMLDirectMapping();
cacheSyncTypeMapping.setAttributeName("cacheSynchronizationType");
cacheSyncTypeMapping.setXPath(getPrimaryNamespaceXPath() + "caching/" + getPrimaryNamespaceXPath() + "cache-sync-type/text()");
ObjectTypeConverter cacheSyncTypeConverter = new ObjectTypeConverter();
cacheSyncTypeConverter.addConversionValue("invalidation", new Integer(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS));
cacheSyncTypeConverter.addConversionValue("no-changes", new Integer(ClassDescriptor.DO_NOT_SEND_CHANGES));
cacheSyncTypeConverter.addConversionValue("change-set-with-new-objects", new Integer(ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES));
cacheSyncTypeConverter.addConversionValue("change-set", new Integer(ClassDescriptor.SEND_OBJECT_CHANGES));
cacheSyncTypeMapping.setConverter(cacheSyncTypeConverter);
cacheSyncTypeMapping.setNullValue(new Integer(ClassDescriptor.SEND_OBJECT_CHANGES));
descriptor.addMapping(cacheSyncTypeMapping);
XMLCompositeObjectMapping historyPolicyMapping = new XMLCompositeObjectMapping();