/** * 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. * The domainObject sent as parameter is always a copy from the parent of unit of work. * bug 2612602 make a call to build a working clone. This will in turn call the copy policy * to make a working clone. This allows for lighter and heavier clones to * be created based on their use. * this allows the stub of the clone to be registered before cloning its parts. */ public Object instantiateWorkingCopyClone(Object domainObject, AbstractSession session) { return this.descriptor.getCopyPolicy().buildWorkingCopyClone(domainObject, session); }
/** * It is now possible to build working copy clones directly from rows. * <p>An intermediary original is no longer needed. * <p>This has ramifications to the copy policy and cmp, for clones are * no longer built via cloning. * <p>Instead the copy policy must in some cases not copy at all. * this allows the stub of the clone to be registered before cloning its parts. */ public Object instantiateWorkingCopyCloneFromRow(AbstractRecord row, ObjectBuildingQuery query, Object primaryKey, UnitOfWorkImpl unitOfWork) { return this.descriptor.getCopyPolicy().buildWorkingCopyCloneFromRow(row, query, primaryKey, unitOfWork); }
getCopyPolicy().initialize(session); getInstantiationPolicy().initialize(session); if (getSchemaReference() != null) {
/** * INTERNAL: * Return if this mapping requires its attribute value to be cloned. */ @Override public boolean isCloningRequired() { return isMutable() || getDescriptor().getCopyPolicy().buildsNewInstance(); }
/** * INTERNAL: * Set the copy policy. * This would be 'protected' but the EJB stuff in another * package needs it to be public */ public void setCopyPolicy(CopyPolicy policy) { copyPolicy = policy; if (policy != null) { policy.setDescriptor(this); } }
clonedDescriptor.setCopyPolicy((CopyPolicy)getCopyPolicy().clone());
return workingClone; workingClone = descriptor.getCopyPolicy().buildWorkingCopyCloneFromPrimaryKeyObject(primaryKeyObject, query, unitOfWork); unitOfWorkCacheKey.setObject(workingClone); unitOfWork.getCloneMapping().put(workingClone, workingClone);
getCopyPolicy().initialize(session); getInstantiationPolicy().initialize(session);
/** * INTERNAL: * Return if this mapping requires its attribute value to be cloned. */ public boolean isCloningRequired() { return isMutable() || getDescriptor().getCopyPolicy().buildsNewInstance(); }
/** * INTERNAL: * Set the copy policy. * This would be 'protected' but the EJB stuff in another * package needs it to be public */ public void setCopyPolicy(CopyPolicy policy) { copyPolicy = policy; if (policy != null) { policy.setDescriptor(this); } }
clonedDescriptor.setCopyPolicy((CopyPolicy)getCopyPolicy().clone());
getCopyPolicy().initialize(session); getInstantiationPolicy().initialize(session); getCachePolicy().initialize(this, session);
/** * INTERNAL: * Return if this mapping requires its attribute value to be cloned. */ @Override public boolean isCloningRequired() { return isMutable() || getDescriptor().getCopyPolicy().buildsNewInstance(); }
/** * 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. * The domainObject sent as parameter is always a copy from the parent of unit of work. * bug 2612602 make a call to build a working clone. This will in turn call the copy policy * to make a working clone. This allows for lighter and heavier clones to * be created based on their use. * this allows the stub of the clone to be registered before cloning its parts. */ public Object instantiateWorkingCopyClone(Object domainObject, AbstractSession session) { return this.descriptor.getCopyPolicy().buildWorkingCopyClone(domainObject, session); }
/** * It is now possible to build working copy clones directly from rows. * <p>An intermediary original is no longer needed. * <p>This has ramifications to the copy policy and cmp, for clones are * no longer built via cloning. * <p>Instead the copy policy must in some cases not copy at all. * this allows the stub of the clone to be registered before cloning its parts. */ public Object instantiateWorkingCopyCloneFromRow(AbstractRecord row, ObjectBuildingQuery query, Object primaryKey, UnitOfWorkImpl unitOfWork) { return this.descriptor.getCopyPolicy().buildWorkingCopyCloneFromRow(row, query, primaryKey, unitOfWork); }
/** * INTERNAL: * Set the copy policy. * This would be 'protected' but the EJB stuff in another * package needs it to be public */ public void setCopyPolicy(CopyPolicy policy) { copyPolicy = policy; if (policy != null) { policy.setDescriptor(this); } }
clonedDescriptor.setCopyPolicy((CopyPolicy)getCopyPolicy().clone());
getCopyPolicy().initialize(session); getInstantiationPolicy().initialize(session); getCachePolicy().initialize(this, session);