/** * Returns the clone of the specified object. This is called only from unit of work. * This only instantiates the clone instance, it does not clone the attributes, * this allows the stub of the clone to be registered before cloning its parts. */ public Object instantiateClone(Object domainObject, AbstractSession session) { Object clone = this.descriptor.getCopyPolicy().buildClone(domainObject, session); // Clear change tracker. if (clone instanceof ChangeTracker) { ((ChangeTracker)clone)._persistence_setPropertyChangeListener(null); } return clone; }
/** * Returns the clone of the specified object. This is called only from unit of work. * This only instantiates the clone instance, it does not clone the attributes, * this allows the stub of the clone to be registered before cloning its parts. */ public Object instantiateClone(Object domainObject, AbstractSession session) { Object clone = this.descriptor.getCopyPolicy().buildClone(domainObject, session); // Clear change tracker. if (clone instanceof ChangeTracker) { ((ChangeTracker)clone)._persistence_setPropertyChangeListener(null); } if(clone instanceof FetchGroupTracker) { ((FetchGroupTracker)clone)._persistence_setFetchGroup(null); ((FetchGroupTracker)clone)._persistence_setSession(null); } clearPrimaryKey(clone); return clone; }
/** * Returns the clone of the specified object. This is called only from unit of work. * This only instantiates the clone instance, it does not clone the attributes, * this allows the stub of the clone to be registered before cloning its parts. */ public Object instantiateClone(Object domainObject, AbstractSession session) { Object clone = this.descriptor.getCopyPolicy().buildClone(domainObject, session); // Clear change tracker. if (clone instanceof ChangeTracker) { ((ChangeTracker)clone)._persistence_setPropertyChangeListener(null); } if(clone instanceof FetchGroupTracker) { ((FetchGroupTracker)clone)._persistence_setFetchGroup(null); ((FetchGroupTracker)clone)._persistence_setSession(null); } clearPrimaryKey(clone); return clone; }
/** * Returns the backup clone of the specified object. This is called only from unit of work. * The clone sent as parameter is always a working copy from the unit of work. */ public Object buildBackupClone(Object clone, UnitOfWorkImpl unitOfWork) { // The copy policy builds clone . ClassDescriptor descriptor = this.descriptor; Object backup = descriptor.getCopyPolicy().buildClone(clone, unitOfWork); // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = getCloningMappings(); int size = mappings.size(); if (descriptor.hasFetchGroupManager() && descriptor.getFetchGroupManager().isPartialObject(clone)) { FetchGroupManager fetchGroupManager = descriptor.getFetchGroupManager(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); if (fetchGroupManager.isAttributeFetched(clone, mapping.getAttributeName())) { mapping.buildBackupClone(clone, backup, unitOfWork); } } } else { for (int index = 0; index < size; index++) { ((DatabaseMapping)mappings.get(index)).buildBackupClone(clone, backup, unitOfWork); } } return backup; }
/** * Returns the backup clone of the specified object. This is called only from unit of work. * The clone sent as parameter is always a working copy from the unit of work. */ public Object buildBackupClone(Object clone, UnitOfWorkImpl unitOfWork) { // The copy policy builds clone . ClassDescriptor descriptor = this.descriptor; Object backup = descriptor.getCopyPolicy().buildClone(clone, unitOfWork); // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = getCloningMappings(); int size = mappings.size(); if (descriptor.hasFetchGroupManager() && descriptor.getFetchGroupManager().isPartialObject(clone)) { FetchGroupManager fetchGroupManager = descriptor.getFetchGroupManager(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); if (fetchGroupManager.isAttributeFetched(clone, mapping.getAttributeName())) { mapping.buildBackupClone(clone, backup, unitOfWork); } } } else { for (int index = 0; index < size; index++) { ((DatabaseMapping)mappings.get(index)).buildBackupClone(clone, backup, unitOfWork); } } return backup; }
/** * Returns the backup clone of the specified object. This is called only from unit of work. * The clone sent as parameter is always a working copy from the unit of work. */ public Object buildBackupClone(Object clone, UnitOfWorkImpl unitOfWork) { // The copy policy builds clone . ClassDescriptor descriptor = this.descriptor; Object backup = descriptor.getCopyPolicy().buildClone(clone, unitOfWork); // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = getCloningMappings(); int size = mappings.size(); if (descriptor.hasFetchGroupManager() && descriptor.getFetchGroupManager().isPartialObject(clone)) { FetchGroupManager fetchGroupManager = descriptor.getFetchGroupManager(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); if (fetchGroupManager.isAttributeFetched(clone, mapping.getAttributeName())) { mapping.buildBackupClone(clone, backup, unitOfWork); } } } else { for (int index = 0; index < size; index++) { ((DatabaseMapping)mappings.get(index)).buildBackupClone(clone, backup, unitOfWork); } } return backup; }