/** * INTERNAL: It is responsible for initializing the policy; */ @Override public void initialize(AbstractSession session) { super.initialize(session); List<DatabaseField> lockFields = getLockFields(); int size = lockFields.size(); for (int index = 0; index < size; index++) { DatabaseField field = lockFields.get(index); field = descriptor.buildField(field); lockFields.set(index, field); List<DatabaseField> fieldsForTable = getLockFieldsByTable().get(field.getTable()); if (fieldsForTable == null) { fieldsForTable = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); getLockFieldsByTable().put(field.getTable(), fieldsForTable); } fieldsForTable.add(field); } }
/** * INTERNAL: It is responsible for initializing the policy; */ @Override public void initialize(AbstractSession session) { super.initialize(session); List<DatabaseField> lockFields = getLockFields(); int size = lockFields.size(); for (int index = 0; index < size; index++) { DatabaseField field = lockFields.get(index); field = descriptor.buildField(field); lockFields.set(index, field); List<DatabaseField> fieldsForTable = getLockFieldsByTable().get(field.getTable()); if (fieldsForTable == null) { fieldsForTable = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); getLockFieldsByTable().put(field.getTable(), fieldsForTable); } fieldsForTable.add(field); } }
/** * INTERNAL: * It is responsible for initializing the policy; */ public void initialize(AbstractSession session) { super.initialize(session); List lockFields = getLockFields(); int size = lockFields.size(); for (int index = 0; index < size; index++) { DatabaseField field = (DatabaseField)lockFields.get(index); field = descriptor.buildField(field); lockFields.set(index, field); Vector fieldsForTable = (Vector)getLockFieldsByTable().get(field.getTable()); if (fieldsForTable == null) { fieldsForTable = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(); getLockFieldsByTable().put(field.getTable(), fieldsForTable); } fieldsForTable.addElement(field); } }
/** * INTERNAL: * Values to be included in the locking mechanism are added to the translation row. * For changed fields the normal build row is ok as only changed fields matter. */ public void addLockValuesToTranslationRow(ObjectLevelModifyQuery query) throws DatabaseException{ Object object; verifyUsage(query.getSession()); if (query.isDeleteObjectQuery()) { object = query.getObject(); } else { object = query.getBackupClone(); } for (Iterator vectors = getLockFieldsByTable().values().iterator(); vectors.hasNext();) { for (Enumeration fields = ((Vector)vectors.next()).elements(); fields.hasMoreElements();) { DatabaseField field = (DatabaseField)fields.nextElement(); DatabaseMapping mapping = descriptor.getObjectBuilder().getMappingForField(field); //Bug5892889, Exception will be thrown if no matched database field found if(mapping == null ){ throw DatabaseException.specifiedLockingFieldsNotFoundInDatabase(field.getQualifiedName()); }else{ mapping.writeFromObjectIntoRow(object, query.getTranslationRow(), query.getSession()); } } } }
for (Iterator<List<DatabaseField>> fields = getLockFieldsByTable().values().iterator(); fields.hasNext();) { for (DatabaseField field : fields.next()) { DatabaseMapping mapping = descriptor.getObjectBuilder().getMappingForField(field);
for (Iterator<List<DatabaseField>> fields = getLockFieldsByTable().values().iterator(); fields.hasNext();) { for (DatabaseField field : fields.next()) { DatabaseMapping mapping = descriptor.getObjectBuilder().getMappingForField(field);