congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
EISOneToOneMapping.getSourceToTargetKeyFields
Code IndexAdd Tabnine to your IDE (free)

How to use
getSourceToTargetKeyFields
method
in
org.eclipse.persistence.eis.mappings.EISOneToOneMapping

Best Java code snippets using org.eclipse.persistence.eis.mappings.EISOneToOneMapping.getSourceToTargetKeyFields (Showing top 20 results out of 315)

origin: com.haulmont.thirdparty/eclipselink

public Object getAttributeValueFromObject(Object object) {
  Map sourceToTargetKeyFields = ((EISOneToOneMapping)object).getSourceToTargetKeyFields();
  List associations = new ArrayList(sourceToTargetKeyFields.size());
  Iterator iterator = sourceToTargetKeyFields.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry = (Map.Entry)iterator.next();
    associations.add(new Association(entry.getKey(), entry.getValue()));
  }
  return associations;
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

public Object getAttributeValueFromObject(Object object) {
  Map sourceToTargetKeyFields = ((EISOneToOneMapping)object).getSourceToTargetKeyFields();
  List associations = new ArrayList(sourceToTargetKeyFields.size());
  Iterator iterator = sourceToTargetKeyFields.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry = (Map.Entry)iterator.next();
    associations.add(new Association(entry.getKey(), entry.getValue()));
  }
  return associations;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

public Object getAttributeValueFromObject(Object object) {
  Map sourceToTargetKeyFields = ((EISOneToOneMapping)object).getSourceToTargetKeyFields();
  List associations = new ArrayList(sourceToTargetKeyFields.size());
  Iterator iterator = sourceToTargetKeyFields.entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry = (Map.Entry)iterator.next();
    associations.add(new Association(entry.getKey(), entry.getValue()));
  }
  return associations;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Extract the key value from the reference object.
 */
protected Vector extractKeyFromReferenceObject(Object object, AbstractSession session) {
  Vector key = new Vector();
  Iterator sourceKeyIterator = getSourceToTargetKeyFields().keySet().iterator();
  while (sourceKeyIterator.hasNext()) {
    DatabaseField field = (DatabaseField)sourceKeyIterator.next();
    if (object == null) {
      key.addElement(null);
    } else {
      key.addElement(getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(object, field, session));
    }
  }
  return key;
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
   * PUBLIC:
   * Define the source foreign key relationship in the one-to-one mapping.
   * This method is used to add foreign key relationships to the mapping.
   * Both the source foreign key field name and the corresponding
   * target primary key field name must be specified.
   */
public void addForeignKeyField(DatabaseField sourceForeignKeyField, DatabaseField targetKeyField) {
  this.getSourceToTargetKeyFields().put(sourceForeignKeyField, targetKeyField);
  this.getTargetToSourceKeyFields().put(targetKeyField, sourceForeignKeyField);
  this.getForeignKeyFields().add(sourceForeignKeyField);
  this.setIsForeignKeyRelationship(true);
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * PUBLIC:
 * Define the source foreign key relationship in the one-to-one mapping.
 * This method is used to add foreign key relationships to the mapping.
 * Both the source foreign key field name and the corresponding
 * target primary key field name must be specified.
 */
@Override
public void addForeignKeyField(DatabaseField sourceForeignKeyField, DatabaseField targetKeyField) {
  getSourceToTargetKeyFields().put(sourceForeignKeyField, targetKeyField);
  getTargetToSourceKeyFields().put(targetKeyField, sourceForeignKeyField);
  getForeignKeyFields().add(sourceForeignKeyField);
  setIsForeignKeyRelationship(true);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * PUBLIC:
 * Define the source foreign key relationship in the one-to-one mapping.
 * This method is used to add foreign key relationships to the mapping.
 * Both the source foreign key field name and the corresponding
 * target primary key field name must be specified.
 */
@Override
public void addForeignKeyField(DatabaseField sourceForeignKeyField, DatabaseField targetKeyField) {
  getSourceToTargetKeyFields().put(sourceForeignKeyField, targetKeyField);
  getTargetToSourceKeyFields().put(targetKeyField, sourceForeignKeyField);
  getForeignKeyFields().add(sourceForeignKeyField);
  setIsForeignKeyRelationship(true);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

  public void setAttributeValueInObject(Object object, Object value) {
    EISOneToOneMapping mapping = (EISOneToOneMapping)object;
    List associations = (List)value;
    mapping.setSourceToTargetKeyFields(new HashMap(associations.size() + 1));
    mapping.setTargetToSourceKeyFields(new HashMap(associations.size() + 1));
    Iterator iterator = associations.iterator();
    while (iterator.hasNext()) {
      Association association = (Association)iterator.next();
      mapping.getSourceToTargetKeyFields().put((DatabaseField)association.getKey(), (DatabaseField)association.getValue());
      mapping.getTargetToSourceKeyFields().put((DatabaseField)association.getValue(), (DatabaseField)association.getKey());
    }
  }
});
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * The foreign keys primary keys are stored as database fields in the hashtable.
 */
protected void initializeForeignKeys(AbstractSession session) {
  HashMap newSourceToTargetKeyFields = new HashMap(getSourceToTargetKeyFields().size());
  HashMap newTargetToSourceKeyFields = new HashMap(getTargetToSourceKeyFields().size());
  Iterator iterator = getSourceToTargetKeyFields().entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry = (Map.Entry)iterator.next();
    DatabaseField sourceField = (DatabaseField)entry.getKey();
    DatabaseField targetField = (DatabaseField)entry.getValue();
    sourceField = getDescriptor().buildField(sourceField);
    targetField = getReferenceDescriptor().buildField(targetField);
    newSourceToTargetKeyFields.put(sourceField, targetField);
    newTargetToSourceKeyFields.put(targetField, sourceField);
  }
  setSourceToTargetKeyFields(newSourceToTargetKeyFields);
  setTargetToSourceKeyFields(newTargetToSourceKeyFields);
}
origin: com.haulmont.thirdparty/eclipselink

  public void setAttributeValueInObject(Object object, Object value) {
    EISOneToOneMapping mapping = (EISOneToOneMapping)object;
    List associations = (List)value;
    mapping.setSourceToTargetKeyFields(new HashMap(associations.size() + 1));
    mapping.setTargetToSourceKeyFields(new HashMap(associations.size() + 1));
    Iterator iterator = associations.iterator();
    while (iterator.hasNext()) {
      Association association = (Association)iterator.next();
      mapping.getSourceToTargetKeyFields().put((DatabaseField)association.getKey(), (DatabaseField)association.getValue());
      mapping.getTargetToSourceKeyFields().put((DatabaseField)association.getValue(), (DatabaseField)association.getKey());
    }
  }
});
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * The foreign keys primary keys are stored as database fields in the hashtable.
 */
protected void initializeForeignKeys(AbstractSession session) {
  HashMap newSourceToTargetKeyFields = new HashMap(getSourceToTargetKeyFields().size());
  HashMap newTargetToSourceKeyFields = new HashMap(getTargetToSourceKeyFields().size());
  Iterator iterator = getSourceToTargetKeyFields().entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry = (Map.Entry)iterator.next();
    DatabaseField sourceField = (DatabaseField)entry.getKey();
    DatabaseField targetField = (DatabaseField)entry.getValue();
    sourceField = getDescriptor().buildField(sourceField);
    targetField = getReferenceDescriptor().buildField(targetField);
    newSourceToTargetKeyFields.put(sourceField, targetField);
    newTargetToSourceKeyFields.put(targetField, sourceField);
  }
  setSourceToTargetKeyFields(newSourceToTargetKeyFields);
  setTargetToSourceKeyFields(newTargetToSourceKeyFields);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

  public void setAttributeValueInObject(Object object, Object value) {
    EISOneToOneMapping mapping = (EISOneToOneMapping)object;
    List associations = (List)value;
    mapping.setSourceToTargetKeyFields(new HashMap(associations.size() + 1));
    mapping.setTargetToSourceKeyFields(new HashMap(associations.size() + 1));
    Iterator iterator = associations.iterator();
    while (iterator.hasNext()) {
      Association association = (Association)iterator.next();
      mapping.getSourceToTargetKeyFields().put(association.getKey(), association.getValue());
      mapping.getTargetToSourceKeyFields().put(association.getValue(), association.getKey());
    }
  }
});
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * The foreign keys primary keys are stored as database fields in the hashtable.
 */
protected void initializeForeignKeys(AbstractSession session) {
  HashMap newSourceToTargetKeyFields = new HashMap(getSourceToTargetKeyFields().size());
  HashMap newTargetToSourceKeyFields = new HashMap(getTargetToSourceKeyFields().size());
  Iterator iterator = getSourceToTargetKeyFields().entrySet().iterator();
  while (iterator.hasNext()) {
    Map.Entry entry = (Map.Entry)iterator.next();
    DatabaseField sourceField = (DatabaseField)entry.getKey();
    DatabaseField targetField = (DatabaseField)entry.getValue();
    sourceField = getDescriptor().buildField(sourceField);
    targetField = getReferenceDescriptor().buildField(targetField);
    newSourceToTargetKeyFields.put(sourceField, targetField);
    newTargetToSourceKeyFields.put(targetField, sourceField);
  }
  setSourceToTargetKeyFields(newSourceToTargetKeyFields);
  setTargetToSourceKeyFields(newTargetToSourceKeyFields);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Selection criteria is created with source foreign keys and target keys.
 * This criteria is then used to read target records from the table.
 *
 * CR#3922 - This method is almost the same as buildSelectionCriteria() the difference
 * is that getSelectionCriteria() is called
 */
protected void initializeSelectionCriteria(AbstractSession session) {
  if (this.getSourceToTargetKeyFields().isEmpty()) {
    throw DescriptorException.noForeignKeysAreSpecified(this);
  }
  Expression criteria;
  Expression builder = new ExpressionBuilder();
  Iterator keyIterator = getSourceToTargetKeyFields().keySet().iterator();
  while (keyIterator.hasNext()) {
    DatabaseField foreignKey = (DatabaseField)keyIterator.next();
    DatabaseField targetKey = (DatabaseField)getSourceToTargetKeyFields().get(foreignKey);
    Expression expression = builder.getField(targetKey).equal(builder.getParameter(foreignKey));
    criteria = expression.and(getSelectionCriteria());
    setSelectionCriteria(criteria);
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Selection criteria is created with source foreign keys and target keys.
 * This criteria is then used to read target records from the table.
 *
 * CR#3922 - This method is almost the same as buildSelectionCriteria() the difference
 * is that getSelectionCriteria() is called
 */
protected void initializeSelectionCriteria(AbstractSession session) {
  if (this.getSourceToTargetKeyFields().isEmpty()) {
    throw DescriptorException.noForeignKeysAreSpecified(this);
  }
  Expression criteria;
  Expression builder = new ExpressionBuilder();
  Iterator keyIterator = getSourceToTargetKeyFields().keySet().iterator();
  while (keyIterator.hasNext()) {
    DatabaseField foreignKey = (DatabaseField)keyIterator.next();
    DatabaseField targetKey = getSourceToTargetKeyFields().get(foreignKey);
    Expression expression = builder.getField(targetKey).equal(builder.getParameter(foreignKey));
    criteria = expression.and(getSelectionCriteria());
    setSelectionCriteria(criteria);
  }
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Selection criteria is created with source foreign keys and target keys.
 * This criteria is then used to read target records from the table.
 *
 * CR#3922 - This method is almost the same as buildSelectionCriteria() the difference
 * is that getSelectionCriteria() is called
 */
protected void initializeSelectionCriteria(AbstractSession session) {
  if (this.getSourceToTargetKeyFields().isEmpty()) {
    throw DescriptorException.noForeignKeysAreSpecified(this);
  }
  Expression criteria;
  Expression builder = new ExpressionBuilder();
  Iterator keyIterator = getSourceToTargetKeyFields().keySet().iterator();
  while (keyIterator.hasNext()) {
    DatabaseField foreignKey = (DatabaseField)keyIterator.next();
    DatabaseField targetKey = getSourceToTargetKeyFields().get(foreignKey);
    Expression expression = builder.getField(targetKey).equal(builder.getParameter(foreignKey));
    criteria = expression.and(getSelectionCriteria());
    setSelectionCriteria(criteria);
  }
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Return the classifiction for the field contained in the mapping.
 * This is used to convert the row value to a consistent java value.
 */
public Class getFieldClassification(DatabaseField fieldToClassify) throws DescriptorException {
  DatabaseField fieldInTarget = (DatabaseField)getSourceToTargetKeyFields().get(fieldToClassify);
  if (fieldInTarget == null) {
    return null;// Can be registered as multiple table secondary field mapping
  }
  DatabaseMapping mapping = getReferenceDescriptor().getObjectBuilder().getMappingForField(fieldInTarget);
  if (mapping == null) {
    return null;// Means that the mapping is read-only
  }
  return mapping.getFieldClassification(fieldInTarget);
}
origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Return the classifiction for the field contained in the mapping.
 * This is used to convert the row value to a consistent java value.
 */
@Override
public Class getFieldClassification(DatabaseField fieldToClassify) throws DescriptorException {
  DatabaseField fieldInTarget = getSourceToTargetKeyFields().get(fieldToClassify);
  if (fieldInTarget == null) {
    return null;// Can be registered as multiple table secondary field mapping
  }
  DatabaseMapping mapping = getReferenceDescriptor().getObjectBuilder().getMappingForField(fieldInTarget);
  if (mapping == null) {
    return null;// Means that the mapping is read-only
  }
  return mapping.getFieldClassification(fieldInTarget);
}
origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Return the classifiction for the field contained in the mapping.
 * This is used to convert the row value to a consistent java value.
 */
@Override
public Class getFieldClassification(DatabaseField fieldToClassify) throws DescriptorException {
  DatabaseField fieldInTarget = getSourceToTargetKeyFields().get(fieldToClassify);
  if (fieldInTarget == null) {
    return null;// Can be registered as multiple table secondary field mapping
  }
  DatabaseMapping mapping = getReferenceDescriptor().getObjectBuilder().getMappingForField(fieldInTarget);
  if (mapping == null) {
    return null;// Means that the mapping is read-only
  }
  return mapping.getFieldClassification(fieldInTarget);
}
origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Extract the foreign key value from the source row.
 */
protected Vector extractForeignKeyFromRow(AbstractRecord row, AbstractSession session) {
  Vector key = new Vector();
  Iterator sourceKeyIterator = getSourceToTargetKeyFields().keySet().iterator();
  while (sourceKeyIterator.hasNext()) {
    DatabaseField field = (DatabaseField)sourceKeyIterator.next();
    Object value = row.get(field);
    // Must ensure the classification gets a cache hit.
    try {
      value = session.getDatasourcePlatform().getConversionManager().convertObject(value, getDescriptor().getObjectBuilder().getFieldClassification(field));
    } catch (ConversionException e) {
      throw ConversionException.couldNotBeConverted(this, getDescriptor(), e);
    }
    key.addElement(value);
  }
  return key;
}
org.eclipse.persistence.eis.mappingsEISOneToOneMappinggetSourceToTargetKeyFields

Javadoc

INTERNAL: Gets the foreign key fields.

Popular methods of EISOneToOneMapping

  • addForeignKeyField
    PUBLIC: Define the source foreign key relationship in the one-to-one mapping. This method is used to
  • collectFields
  • getAttributeName
  • getAttributeValueFromObject
  • getDescriptor
  • getFields
  • getForeignKeyFields
  • getIndirectionPolicy
  • getPrivateOwnedCriteria
    INTERNAL: The private owned criteria is only used outside of the unit of work to compare the previou
  • getRealAttributeValueFromObject
  • getReferenceDescriptor
  • getSelectionCriteria
  • getReferenceDescriptor,
  • getSelectionCriteria,
  • getSelectionQuery,
  • getTargetToSourceKeyFields,
  • initializeForeignKeys,
  • initializePrivateOwnedCriteria,
  • initializeSelectionCriteria,
  • isForeignKeyRelationship,
  • isPrivateOwned

Popular in Java

  • Finding current android device location
  • setScale (BigDecimal)
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Collectors (java.util.stream)
  • Runner (org.openjdk.jmh.runner)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now