/** * INTERNAL * Called when a DatabaseMapping is used to map the key in a collection. Returns the key. */ public Object createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, AbstractSession session){ Object key = dbRow.get(getDirectField()); if (getValueConverter() != null){ key = getValueConverter().convertDataValueToObjectValue(key, session); } return key; }
/** * INTERNAL * Called when a DatabaseMapping is used to map the key in a collection. Returns the key. */ @Override public Object createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected){ Object key = dbRow.get(getDirectField()); if (getValueConverter() != null){ key = getValueConverter().convertDataValueToObjectValue(key, session); } return key; }
/** * INTERNAL * Called when a DatabaseMapping is used to map the key in a collection. Returns the key. */ public Object createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected){ Object key = dbRow.get(getDirectField()); if (getValueConverter() != null){ key = getValueConverter().convertDataValueToObjectValue(key, session); } return key; }
protected void initializeSelectionStatement(AbstractSession session) { if (selectionQuery.isReadAllQuery()){ ((ReadAllQuery)selectionQuery).addAdditionalField((DatabaseField)getDirectField().clone()); } else { SQLSelectStatement statement = (SQLSelectStatement)selectionQuery.getSQLStatement(); statement.addTable(getReferenceTable()); statement.addField((DatabaseField)getDirectField().clone()); getContainerPolicy().addAdditionalFieldsToQuery(selectionQuery, null); statement.normalize(session, null); } if (selectionQuery.isDirectReadQuery()){ ((DirectReadQuery)selectionQuery).setResultType(DataReadQuery.MAP); } }
@Override protected void initializeSelectionStatement(AbstractSession session) { if (this.selectionQuery.isReadAllQuery()){ ((ReadAllQuery)this.selectionQuery).addAdditionalField(getDirectField().clone()); } else { SQLSelectStatement statement = (SQLSelectStatement)this.selectionQuery.getSQLStatement(); statement.addTable(getReferenceTable()); statement.addField(getDirectField().clone()); getContainerPolicy().addAdditionalFieldsToQuery(this.selectionQuery, getAdditionalFieldsBaseExpression(this.selectionQuery)); statement.normalize(session, null); } if (this.selectionQuery.isDirectReadQuery()){ ((DirectReadQuery)this.selectionQuery).setResultType(DataReadQuery.MAP); } }
@Override protected void initializeSelectionStatement(AbstractSession session) { if (this.selectionQuery.isReadAllQuery()){ ((ReadAllQuery)this.selectionQuery).addAdditionalField(getDirectField().clone()); } else { SQLSelectStatement statement = (SQLSelectStatement)this.selectionQuery.getSQLStatement(); statement.addTable(getReferenceTable()); statement.addField(getDirectField().clone()); getContainerPolicy().addAdditionalFieldsToQuery(this.selectionQuery, getAdditionalFieldsBaseExpression(this.selectionQuery)); statement.normalize(session, null); } if (this.selectionQuery.isDirectReadQuery()){ ((DirectReadQuery)this.selectionQuery).setResultType(DataReadQuery.MAP); } }
Object directValue = targetRow.get(getDirectField());
value = getFieldValue(value, writeQuery.getSession()); ContainerPolicy.copyMapDataToRow(this.containerPolicy.getKeyMappingDataForWriteQuery(entry, writeQuery.getSession()), thisRow); thisRow.add(getDirectField(), value);
value = getFieldValue(value, writeQuery.getSession()); ContainerPolicy.copyMapDataToRow(this.containerPolicy.getKeyMappingDataForWriteQuery(entry, writeQuery.getSession()), thisRow); thisRow.add(getDirectField(), value);
value = getFieldValue(value, writeQuery.getSession()); ContainerPolicy.copyMapDataToRow(this.containerPolicy.getKeyMappingDataForWriteQuery(entry, writeQuery.getSession()), thisRow); thisRow.add(getDirectField(), value);
/** * {@inheritDoc} */ @Override public void visit(ValueExpression expression) { IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression(); Declaration declaration = queryContext.findDeclaration(identificationVariable.getVariableName()); DatabaseMapping mapping = declaration.getMapping(); if (mapping.isDirectMapMapping()) { DirectMapMapping mapMapping = (DirectMapMapping) mapping; type = mapMapping.getValueClass(); if (type == null) { type = mapMapping.getDirectField().getType(); } } else { type = calculateMappingType(declaration.getMapping()); } }
referenceKey = getDirectMapUsableContainerPolicy().buildKey(databaseRow, null, session); Object referenceValue = referenceRow.get(getDirectField()); CacheKey eachCacheKey = new CacheKey(extractKeyFromTargetRow(referenceRow, session));
/** * {@inheritDoc} */ @Override public void visit(ValueExpression expression) { IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression(); Declaration declaration = queryContext.findDeclaration(identificationVariable.getVariableName()); DatabaseMapping mapping = declaration.getMapping(); if (mapping.isDirectMapMapping()) { DirectMapMapping mapMapping = (DirectMapMapping) mapping; type = mapMapping.getValueClass(); if (type == null) { type = mapMapping.getDirectField().getType(); } } else { type = calculateMappingType(declaration.getMapping()); } }
Map.Entry entry = (Map.Entry)this.containerPolicy.nextEntry(keyIter, query.getSession()); Object value = getFieldValue(entry.getValue(), query.getSession()); databaseRow.put(getDirectField(), value);
Map.Entry entry = (Map.Entry)this.containerPolicy.nextEntry(keyIter, query.getSession()); Object value = getFieldValue(entry.getValue(), query.getSession()); databaseRow.put(getDirectField(), value);
Map.Entry entry = (Map.Entry)this.containerPolicy.nextEntry(keyIter, query.getSession()); Object value = getFieldValue(entry.getValue(), query.getSession()); databaseRow.put(getDirectField(), value);