if (shouldInitializeSelectionCriteria() || requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { throw DescriptorException.noTargetForeignKeysSpecified(this); } else {
if (shouldInitializeSelectionCriteria() || requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { throw DescriptorException.noTargetForeignKeysSpecified(this); } else {
if (shouldInitializeSelectionCriteria() || requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { throw DescriptorException.noTargetForeignKeysSpecified(this); } else {
/** * INTERNAL: * An object was added to the collection during an update, insert it if private. */ @Override protected void objectAddedDuringUpdate(ObjectLevelModifyQuery query, Object objectAdded, ObjectChangeSet changeSet, Map extraData) throws DatabaseException, OptimisticLockException { // First insert/update object. super.objectAddedDuringUpdate(query, objectAdded, changeSet, extraData); if (requiresDataModificationEvents() || containerPolicy.requiresDataModificationEvents()){ // In the uow data queries are cached until the end of the commit. if (query.shouldCascadeOnlyDependentParts()) { // Hey I might actually want to use an inner class here... ok array for now. Object[] event = new Object[4]; event[0] = ObjectAdded; event[1] = query; event[2] = objectAdded; event[3] = extraData; query.getSession().getCommitManager().addDataModificationEvent(this, event); } else { updateTargetForeignKeyPostUpdateSource_ObjectAdded(query, objectAdded, extraData); } } }
/** * INTERNAL: * An object was added to the collection during an update, insert it if private. */ protected void objectAddedDuringUpdate(ObjectLevelModifyQuery query, Object objectAdded, ObjectChangeSet changeSet, Map extraData) throws DatabaseException, OptimisticLockException { // First insert/update object. super.objectAddedDuringUpdate(query, objectAdded, changeSet, extraData); if (requiresDataModificationEvents() || containerPolicy.requiresDataModificationEvents()){ // In the uow data queries are cached until the end of the commit. if (query.shouldCascadeOnlyDependentParts()) { // Hey I might actually want to use an inner class here... ok array for now. Object[] event = new Object[4]; event[0] = ObjectAdded; event[1] = query; event[2] = objectAdded; event[3] = extraData; query.getSession().getCommitManager().addDataModificationEvent(this, event); } else { updateTargetForeignKeyPostUpdateSource_ObjectAdded(query, objectAdded, extraData); } } }
/** * INTERNAL: * Update the reference objects. */ @Override public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { if (this.isReadOnly) { return; } if (!requiresDataModificationEvents() && !shouldObjectModifyCascadeToParts(query)){ return; } // if the target objects are not instantiated, they could not have been changed.... if (!isAttributeValueInstantiatedOrChanged(query.getObject())) { return; } if (query.getObjectChangeSet() != null) { // UnitOfWork writeChanges(query.getObjectChangeSet(), query); } else { // OLD COMMIT compareObjectsAndWrite(query); } }
/** * INTERNAL: * Update the reference objects. */ @Override public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { if (this.isReadOnly) { return; } if (!requiresDataModificationEvents() && !shouldObjectModifyCascadeToParts(query)){ return; } // if the target objects are not instantiated, they could not have been changed.... if (!isAttributeValueInstantiatedOrChanged(query.getObject())) { return; } if (query.getObjectChangeSet() != null) { // UnitOfWork writeChanges(query.getObjectChangeSet(), query); } else { // OLD COMMIT compareObjectsAndWrite(query); } }
/** * INTERNAL: * An object was removed to the collection during an update, delete it if private. */ @Override protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) throws DatabaseException, OptimisticLockException { if(!isPrivateOwned()) { if (requiresDataModificationEvents() || containerPolicy.requiresDataModificationEvents()){ // In the uow data queries are cached until the end of the commit. if (query.shouldCascadeOnlyDependentParts()) { // Hey I might actually want to use an inner class here... ok array for now. Object[] event = new Object[3]; event[0] = ObjectRemoved; event[1] = query; event[2] = objectDeleted; query.getSession().getCommitManager().addDataModificationEvent(this, event); } else { updateTargetForeignKeyPostUpdateSource_ObjectRemoved(query, objectDeleted); } } } // Delete object after join entry is delete if private. super.objectRemovedDuringUpdate(query, objectDeleted, extraData); }
/** * INTERNAL: * An object was removed to the collection during an update, delete it if private. */ protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) throws DatabaseException, OptimisticLockException { if(!isPrivateOwned()) { if (requiresDataModificationEvents() || containerPolicy.requiresDataModificationEvents()){ // In the uow data queries are cached until the end of the commit. if (query.shouldCascadeOnlyDependentParts()) { // Hey I might actually want to use an inner class here... ok array for now. Object[] event = new Object[3]; event[0] = ObjectRemoved; event[1] = query; event[2] = objectDeleted; query.getSession().getCommitManager().addDataModificationEvent(this, event); } else { updateTargetForeignKeyPostUpdateSource_ObjectRemoved(query, objectDeleted); } } } // Delete object after join entry is delete if private. super.objectRemovedDuringUpdate(query, objectDeleted, extraData); }
/** * Initialize and set the descriptor for the referenced class in this mapping. * Added here initialization of target foreign keys and target primary keys so that they are ready when * CollectionMapping.initialize initializes listOrderField. */ protected void initializeReferenceDescriptor(AbstractSession session) throws DescriptorException { super.initializeReferenceDescriptor(session); if (!isSourceKeySpecified()) { // sourceKeyFields will be empty when #setTargetForeignKeyFieldName() is used setSourceKeyFields(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(getDescriptor().getPrimaryKeyFields())); } initializeTargetForeignKeysToSourceKeys(); if(requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { initializeTargetPrimaryKeyFields(); } }
/** * INTERNAL: * An object was removed to the collection during an update, delete it if private. */ @Override protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) throws DatabaseException, OptimisticLockException { if(!isPrivateOwned()) { if (requiresDataModificationEvents() || containerPolicy.requiresDataModificationEvents()){ // In the uow data queries are cached until the end of the commit. if (query.shouldCascadeOnlyDependentParts()) { // Hey I might actually want to use an inner class here... ok array for now. Object[] event = new Object[3]; event[0] = ObjectRemoved; event[1] = query; event[2] = objectDeleted; query.getSession().getCommitManager().addDataModificationEvent(this, event); } else { updateTargetForeignKeyPostUpdateSource_ObjectRemoved(query, objectDeleted); } } } // Delete object after join entry is delete if private. super.objectRemovedDuringUpdate(query, objectDeleted, extraData); }
/** * INTERNAL: * Update the reference objects. */ public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { if (isReadOnly()) { return; } if (!requiresDataModificationEvents() && !shouldObjectModifyCascadeToParts(query)){ return; } // if the target objects are not instantiated, they could not have been changed.... if (!isAttributeValueInstantiatedOrChanged(query.getObject())) { return; } // manage objects added and removed from the collection Object objectsInMemory = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); Object objectsInDB = readPrivateOwnedForObject(query); compareObjectsAndWrite(objectsInDB, objectsInMemory, query); }
/** * Initialize and set the descriptor for the referenced class in this mapping. * Added here initialization of target foreign keys and target primary keys so that they are ready when * CollectionMapping.initialize initializes listOrderField. */ @Override protected void initializeReferenceDescriptor(AbstractSession session) throws DescriptorException { super.initializeReferenceDescriptor(session); if (!isSourceKeySpecified()) { // sourceKeyFields will be empty when #setTargetForeignKeyFieldName() is used setSourceKeyFields(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(getDescriptor().getPrimaryKeyFields())); } initializeTargetForeignKeysToSourceKeys(); if (usesIndirection()) { for (DatabaseField field : getSourceKeyFields()) { field.setKeepInRow(true); } } if(requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { initializeTargetPrimaryKeyFields(); } }
/** * Initialize and set the descriptor for the referenced class in this mapping. * Added here initialization of target foreign keys and target primary keys so that they are ready when * CollectionMapping.initialize initializes listOrderField. */ protected void initializeReferenceDescriptor(AbstractSession session) throws DescriptorException { super.initializeReferenceDescriptor(session); if (!isSourceKeySpecified()) { // sourceKeyFields will be empty when #setTargetForeignKeyFieldName() is used setSourceKeyFields(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(getDescriptor().getPrimaryKeyFields())); } initializeTargetForeignKeysToSourceKeys(); if (usesIndirection()) { for (DatabaseField field : getSourceKeyFields()) { field.setKeepInRow(true); } } if(requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { initializeTargetPrimaryKeyFields(); } }
if (requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { initializeAddTargetQuery(session); initializeRemoveTargetQuery(session);
if (requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { initializeAddTargetQuery(session); initializeRemoveTargetQuery(session);
if (requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()){ if (!isReadOnly() && (requiresDataModificationEvents() || containerPolicy.shouldUpdateForeignKeysPostInsert())) { if (!isReadOnly() && (requiresDataModificationEvents() || containerPolicy.shouldUpdateForeignKeysPostInsert())){ updateTargetRowPostInsertSource(query);
if (requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()){ if (!isReadOnly() && (requiresDataModificationEvents() || containerPolicy.shouldUpdateForeignKeysPostInsert())) { if (!isReadOnly() && (requiresDataModificationEvents() || containerPolicy.shouldUpdateForeignKeysPostInsert())){ updateTargetRowPostInsertSource(query);
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); getContainerPolicy().initialize(session, getReferenceDescriptor().getDefaultTable()); if (shouldInitializeSelectionCriteria()) { setSelectionCriteria(buildDefaultSelectionCriteriaAndAddFieldsToQuery()); } initializeDeleteAllQuery(); if(requiresDataModificationEvents() || getContainerPolicy().requiresDataModificationEvents()) { initializeAddTargetQuery(session); initializeRemoveTargetQuery(session); initializeRemoveAllTargetsQuery(session); } if (getReferenceDescriptor() != null && getReferenceDescriptor().hasTablePerClassPolicy()) { // This will do nothing if we have already prepared for this // source mapping or if the source mapping does not require // any special prepare logic. getReferenceDescriptor().getTablePerClassPolicy().prepareChildrenSelectionQuery(this, session); } }
if (requiresDataModificationEvents() || containerPolicy.requiresDataModificationEvents()){