/** * PUBLIC: * Get a value indicating the type of cache synchronization that will be used on objects of * this type. Possible values are: * SEND_OBJECT_CHANGES * INVALIDATE_CHANGED_OBJECTS * SEND_NEW_OBJECTS+WITH_CHANGES * DO_NOT_SEND_CHANGES */ public int getCacheSynchronizationType() { return getCachePolicy().getCacheSynchronizationType(); }
/** * PUBLIC: * Get a value indicating the type of cache synchronization that will be used on objects of * this type. Possible values are: * SEND_OBJECT_CHANGES * INVALIDATE_CHANGED_OBJECTS * SEND_NEW_OBJECTS+WITH_CHANGES * DO_NOT_SEND_CHANGES */ public int getCacheSynchronizationType() { return getCachePolicy().getCacheSynchronizationType(); }
/** * INTERNAL: * Return if change sets are required for new objects. */ public boolean shouldUseFullChangeSetsForNewObjects() { return getCachePolicy().getCacheSynchronizationType() == CachePolicy.SEND_NEW_OBJECTS_WITH_CHANGES || shouldUseFullChangeSetsForNewObjects; }
/** * INTERNAL: * Return if change sets are required for new objects. */ public boolean shouldUseFullChangeSetsForNewObjects() { return getCachePolicy().getCacheSynchronizationType() == CachePolicy.SEND_NEW_OBJECTS_WITH_CHANGES || shouldUseFullChangeSetsForNewObjects; }
/** * This constructor is used to create an ObjectChangeSet that represents a regular object. */ public ObjectChangeSet(Object primaryKey, ClassDescriptor descriptor, Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew) { this.cacheSynchronizationType = ClassDescriptor.UNDEFINED_OBJECT_CHANGE_BEHAVIOR; this.cloneObject = cloneObject; this.isNew = isNew; this.shouldBeDeleted = false; this.id = primaryKey; this.classType = descriptor.getJavaClass(); this.className = this.classType.getName(); this.descriptor = descriptor; this.cacheSynchronizationType = descriptor.getCachePolicy().getCacheSynchronizationType(); this.unitOfWorkChangeSet = parent; this.isAggregate = false; }
/** * This constructor is used to create an ObjectChangeSet that represents a regular object. */ public ObjectChangeSet(Object primaryKey, ClassDescriptor descriptor, Object cloneObject, UnitOfWorkChangeSet parent, boolean isNew) { this.cacheSynchronizationType = ClassDescriptor.UNDEFINED_OBJECT_CHANGE_BEHAVIOR; this.cloneObject = cloneObject; this.isNew = isNew; this.shouldBeDeleted = false; this.id = primaryKey; this.classType = descriptor.getJavaClass(); this.className = this.classType.getName(); this.descriptor = descriptor; this.cacheSynchronizationType = descriptor.getCachePolicy().getCacheSynchronizationType(); this.unitOfWorkChangeSet = parent; this.isAggregate = false; }
int syncType = descriptor.getCachePolicy().getCacheSynchronizationType();
/** * INTERNAL: * Allow the inheritance properties of the descriptor to be initialized. * The descriptor's parent must first be initialized. */ public void initializeFromParent(CachePolicy parentPolicy, ClassDescriptor descriptor, ClassDescriptor descriptorDescriptor, AbstractSession session) throws DescriptorException { // If the parent is isolated, then the child must also be isolated. if (!parentPolicy.isSharedIsolation()) { // Do not override cache isolation when explicitly enabled by @Cacheable(true) annotation in current class. boolean copyParrent = cacheable == null || cacheable == false; if (!isIsolated() && (getCacheIsolation() != parentPolicy.getCacheIsolation()) && copyParrent) { session.log(SessionLog.WARNING, SessionLog.METADATA, "overriding_cache_isolation", new Object[]{descriptorDescriptor.getAlias(), parentPolicy.getCacheIsolation(), descriptor.getAlias(), getCacheIsolation()}); setCacheIsolation(parentPolicy.getCacheIsolation()); } } // Child must maintain the same indexes as the parent. for (CacheIndex index : parentPolicy.getCacheIndexes().values()) { addCacheIndex(index); } if ((getDatabaseChangeNotificationType() == null) && (parentPolicy.getDatabaseChangeNotificationType() != null)) { setDatabaseChangeNotificationType(parentPolicy.getDatabaseChangeNotificationType()); } if ((getCacheSynchronizationType() == UNDEFINED_OBJECT_CHANGE_BEHAVIOR) && (parentPolicy.getCacheSynchronizationType() != UNDEFINED_OBJECT_CHANGE_BEHAVIOR)) { setCacheSynchronizationType(parentPolicy.getCacheSynchronizationType()); } }
int syncType = descriptor.getCachePolicy().getCacheSynchronizationType();
/** * INTERNAL: * Allow the inheritance properties of the descriptor to be initialized. * The descriptor's parent must first be initialized. */ public void initializeFromParent(CachePolicy parentPolicy, ClassDescriptor descriptor, ClassDescriptor descriptorDescriptor, AbstractSession session) throws DescriptorException { // If the parent is isolated, then the child must also be isolated. if (!parentPolicy.isSharedIsolation()) { // Do not override cache isolation when explicitly enabled by @Cacheable(true) annotation in current class. boolean copyParrent = cacheable == null || cacheable == false; if (!isIsolated() && (getCacheIsolation() != parentPolicy.getCacheIsolation()) && copyParrent) { session.log(SessionLog.WARNING, SessionLog.METADATA, "overriding_cache_isolation", new Object[]{descriptorDescriptor.getAlias(), parentPolicy.getCacheIsolation(), descriptor.getAlias(), getCacheIsolation()}); setCacheIsolation(parentPolicy.getCacheIsolation()); } } // Child must maintain the same indexes as the parent. for (CacheIndex index : parentPolicy.getCacheIndexes().values()) { addCacheIndex(index); } if ((getDatabaseChangeNotificationType() == null) && (parentPolicy.getDatabaseChangeNotificationType() != null)) { setDatabaseChangeNotificationType(parentPolicy.getDatabaseChangeNotificationType()); } if ((getCacheSynchronizationType() == UNDEFINED_OBJECT_CHANGE_BEHAVIOR) && (parentPolicy.getCacheSynchronizationType() != UNDEFINED_OBJECT_CHANGE_BEHAVIOR)) { setCacheSynchronizationType(parentPolicy.getCacheSynchronizationType()); } }
if (descriptor.getCachePolicy().getCacheSynchronizationType() != CachePolicy.UNDEFINED_OBJECT_CHANGE_BEHAVIOR) { StringBuilder lineToAdd = new StringBuilder("descriptor.setCacheSynchronizationType("); if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.INVALIDATE_CHANGED_OBJECTS) { lineToAdd.append("ClassDescriptor.INVALIDATE_CHANGED_OBJECTS"); } else if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.DO_NOT_SEND_CHANGES) { lineToAdd.append("ClassDescriptor.DO_NOT_SEND_CHANGES"); } else if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.SEND_NEW_OBJECTS_WITH_CHANGES) { lineToAdd.append("ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES"); } else if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.SEND_OBJECT_CHANGES) { lineToAdd.append("ClassDescriptor.SEND_OBJECT_CHANGES");
if (descriptor.getCachePolicy().getCacheSynchronizationType() != CachePolicy.UNDEFINED_OBJECT_CHANGE_BEHAVIOR) { StringBuilder lineToAdd = new StringBuilder("descriptor.setCacheSynchronizationType("); if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.INVALIDATE_CHANGED_OBJECTS) { lineToAdd.append("ClassDescriptor.INVALIDATE_CHANGED_OBJECTS"); } else if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.DO_NOT_SEND_CHANGES) { lineToAdd.append("ClassDescriptor.DO_NOT_SEND_CHANGES"); } else if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.SEND_NEW_OBJECTS_WITH_CHANGES) { lineToAdd.append("ClassDescriptor.SEND_NEW_OBJECTS_WITH_CHANGES"); } else if (descriptor.getCachePolicy().getCacheSynchronizationType() == CachePolicy.SEND_OBJECT_CHANGES) { lineToAdd.append("ClassDescriptor.SEND_OBJECT_CHANGES");