/** * Add the attribute change record. */ public void addChange(ChangeRecord changeRecord) { if (changeRecord == null) { return; } String attributeName = changeRecord.getAttribute(); Map attributeToChanges = getAttributesToChanges(); List changes = getChanges(); ChangeRecord existingChangeRecord = (ChangeRecord)attributeToChanges.get(attributeName); // change tracking may add a change to an existing attribute fix that here. if (existingChangeRecord != null) { changes.remove(existingChangeRecord); } changes.add(changeRecord); attributeToChanges.put(attributeName, changeRecord); dirtyUOWChangeSet(); // now let's do some house keeping. DatabaseMapping mapping = changeRecord.getMapping(); OptimisticLockingPolicy olp = getDescriptor().getOptimisticLockingPolicy(); if (olp != null){ if ((olp.shouldUpdateVersionOnOwnedMappingChange() && mapping.isOwned()) || (olp.shouldUpdateVersionOnMappingChange())){ this.shouldModifyVersionField = true; // must update version field when owned mapping changes } } }
/** * Add the attribute change record. */ public void addChange(ChangeRecord changeRecord) { if (changeRecord == null) { return; } String attributeName = changeRecord.getAttribute(); Map attributeToChanges = getAttributesToChanges(); List changes = getChanges(); ChangeRecord existingChangeRecord = (ChangeRecord)attributeToChanges.get(attributeName); // change tracking may add a change to an existing attribute fix that here. if (existingChangeRecord != null) { changes.remove(existingChangeRecord); } changes.add(changeRecord); attributeToChanges.put(attributeName, changeRecord); dirtyUOWChangeSet(); // now let's do some house keeping. DatabaseMapping mapping = changeRecord.getMapping(); OptimisticLockingPolicy olp = getDescriptor().getOptimisticLockingPolicy(); if (olp != null){ if ((olp.shouldUpdateVersionOnOwnedMappingChange() && mapping.isOwned()) || (olp.shouldUpdateVersionOnMappingChange())){ this.shouldModifyVersionField = true; // must update version field when owned mapping changes } } }
/** * Add the attribute change record. */ public void addChange(ChangeRecord changeRecord) { if (changeRecord == null) { return; } String attributeName = changeRecord.getAttribute(); Map attributeToChanges = getAttributesToChanges(); List changes = getChanges(); ChangeRecord existingChangeRecord = (ChangeRecord)attributeToChanges.get(attributeName); // change tracking may add a change to an existing attribute fix that here. if (existingChangeRecord != null) { changes.remove(existingChangeRecord); } changes.add(changeRecord); attributeToChanges.put(attributeName, changeRecord); dirtyUOWChangeSet(); // now let's do some house keeping. DatabaseMapping mapping = changeRecord.getMapping(); OptimisticLockingPolicy olp = getDescriptor().getOptimisticLockingPolicy(); if (olp != null){ if ((olp.shouldUpdateVersionOnOwnedMappingChange() && mapping.isOwned()) || (olp.shouldUpdateVersionOnMappingChange())){ this.shouldModifyVersionField = true; // must update version field when owned mapping changes } } }