Package org.datanucleus.metadata

Examples of org.datanucleus.metadata.RelationType


                    id = api.getIdForObject(pcNew);
                    if (ec.getApiAdapter().isDetached(value) && ownerSM != null)
                    {
                        // Update any detached reference to refer to the attached variant
                        ownerSM.replaceFieldMakeDirty(ownerFieldNumber, pcNew);
                        RelationType relationType = mmd.getRelationType(clr);
                        if (relationType == RelationType.ONE_TO_ONE_BI)
                        {
                            ObjectProvider relatedSM = ec.findObjectProvider(pcNew);
                            AbstractMemberMetaData[] relatedMmds = mmd.getRelatedMemberMetaData(clr);
                            // TODO Allow for multiple related fields
View Full Code Here


            // Generate a mapping from the columns of the referenced object to this mapping's ColumnMetaData
            CorrespondentColumnsMapper correspondentColumnsMapping = new CorrespondentColumnsMapper(mmd, referenceMapping, true);

            // Find any related field where this is part of a bidirectional relation
            RelationType relationType = mmd.getRelationType(clr);
            boolean createDatastoreMappings = true;
            if (relationType == RelationType.MANY_TO_ONE_BI)
            {
                AbstractMemberMetaData[] relatedMmds = mmd.getRelatedMemberMetaData(clr);
                // TODO Cater for more than 1 related field
View Full Code Here

                        id = api.getIdForObject(pcNew);
                        if (ec.getApiAdapter().isDetached(value) && ownerSM != null)
                        {
                            // Update any detached reference to refer to the attached variant
                            ownerSM.replaceFieldMakeDirty(ownerFieldNumber, pcNew);
                            RelationType relationType = mmd.getRelationType(clr);
                            if (relationType == RelationType.MANY_TO_ONE_BI)
                            {
                                // TODO Update the container to refer to the attached object
                                if (NucleusLogger.PERSISTENCE.isInfoEnabled())
                                {
View Full Code Here

            return;
        }

        ClassLoaderResolver clr = sm.getExecutionContext().getClassLoaderResolver();
        AbstractMemberMetaData[] relatedMmds = mmd.getRelatedMemberMetaData(clr);
        RelationType relationType = mmd.getRelationType(clr);
        if (pc != null)
        {
            if (relationType == RelationType.ONE_TO_ONE_BI)
            {
                ObjectProvider otherSM = sm.getExecutionContext().findObjectProvider(pc);
View Full Code Here

     */
    public void postUpdate(ObjectProvider sm)
    {
        Object pc = sm.provideField(mmd.getAbsoluteFieldNumber());
        ClassLoaderResolver clr = sm.getExecutionContext().getClassLoaderResolver();
        RelationType relationType = mmd.getRelationType(clr);
        if (pc == null)
        {
            if (relationType == RelationType.MANY_TO_ONE_UNI)
            {
                // Update join table entry
View Full Code Here

            return;
        }

        // N-1 Uni, so delete join table entry
        ClassLoaderResolver clr = sm.getExecutionContext().getClassLoaderResolver();
        RelationType relationType = mmd.getRelationType(clr);
        if (relationType == RelationType.MANY_TO_ONE_UNI)
        {
            // Update join table entry
            PersistableRelationStore store =
                (PersistableRelationStore) storeMgr.getBackingStoreForField(
View Full Code Here

    AbstractMemberMetaData ammd = getMemberMetaDataForTuples(acmd, tuples);
    if (ammd == null) {
      throw noMetaDataException(left.getId(), acmd.getFullClassName());
    }

    RelationType relationType = ammd.getRelationType(getClassLoaderResolver());
    if (RelationType.isRelationSingleValued(relationType)) {
      // Reference to persistable object, so use Key or id
      processPersistableMember(qd, op, ammd, value);
    } else if (MetaDataUtils.isParentPKField(ammd)) {
      // Reference to parent
View Full Code Here

    // Process any relation owner fields
    NucleusLogger.DATASTORE.info("Migrating Entity with key=" + entity.getKey() + " for class=" + cls.getName());
    for (int i=0;i<relationFieldNumbers.length;i++) {
      AbstractMemberMetaData mmd = cmd.getMetaDataForManagedMemberAtAbsolutePosition(relationFieldNumbers[i]);
      if (MetaDataUtils.isOwnedRelation(mmd, storeMgr)) {
        RelationType relationType = mmd.getRelationType(clr);
        if (relationType == RelationType.ONE_TO_ONE_UNI ||
            (relationType == RelationType.ONE_TO_ONE_BI && mmd.getMappedBy() == null)) {
          // 1-1 owner
          String propName = EntityUtils.getPropertyName(storeMgr.getIdentifierFactory(), mmd);
          if (!entity.hasProperty(propName)) {
View Full Code Here

  }

  public Object fetchObjectField(int fieldNumber) {
    AbstractMemberMetaData mmd = getMetaData(fieldNumber);
    ClassLoaderResolver clr = getClassLoaderResolver();
    RelationType relationType = mmd.getRelationType(clr);
    if (mmd.getEmbeddedMetaData() != null && RelationType.isRelationSingleValued(relationType)) {
      // Embedded persistable object
      ObjectProvider embeddedOP = getEmbeddedObjectProvider(mmd.getType(), fieldNumber, null);

      fieldManagerStateStack.addFirst(new FieldManagerState(embeddedOP, mmd.getEmbeddedMetaData()));
View Full Code Here

    }
  }

  Object fetchRelationField(ClassLoaderResolver clr, AbstractMemberMetaData mmd) {
    Object value = null;
    RelationType relationType = mmd.getRelationType(clr);
    if (RelationType.isRelationMultiValued(relationType)) {
      String propName = getPropertyNameForMember(mmd);
      if (datastoreEntity.hasProperty(propName)) {
        if (mmd.hasCollection()) {
          // Fields of type Collection<PC>
View Full Code Here

TOP

Related Classes of org.datanucleus.metadata.RelationType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.