Package org.datanucleus.store.scostore

Examples of org.datanucleus.store.scostore.PersistableRelationStore


     * @return The backing store of this persistable relation in this store
     */
    private PersistableRelationStore getBackingStoreForPersistableRelation(AbstractMemberMetaData mmd,
            ClassLoaderResolver clr, Class type)
    {
        PersistableRelationStore store = null;
        DatastoreContainerObject datastoreTable = getDatastoreContainerObject(mmd);
        store = newPersistableRelationStore(mmd, clr, datastoreTable);
        return store;
    }
View Full Code Here


                    Object other = sm.getExecutionContext().persistObjectInternal(pc, null, -1, ObjectProvider.PC);
                    otherSM = sm.getExecutionContext().findObjectProvider(other);
                }

                // Add join table entry
                PersistableRelationStore store =
                    (PersistableRelationStore) storeMgr.getBackingStoreForField(
                        sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
                store.add(sm, otherSM);
            }
        }
    }
View Full Code Here

        if (pc == null)
        {
            if (relationType == Relation.MANY_TO_ONE_UNI)
            {
                // Update join table entry
                PersistableRelationStore store =
                    (PersistableRelationStore) storeMgr.getBackingStoreForField(
                        sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
                store.remove(sm);
            }

            return;
        }
        else
        {
            ObjectProvider otherSM = sm.getExecutionContext().findObjectProvider(pc);
            if (otherSM == null)
            {
                if (relationType == Relation.ONE_TO_ONE_BI || relationType == Relation.MANY_TO_ONE_BI ||
                    relationType == Relation.MANY_TO_ONE_UNI)
                {
                    // Related object is not yet persisted (e.g 1-1 with FK at other side) so persist it
                    Object other = sm.getExecutionContext().persistObjectInternal(pc, null, -1, ObjectProvider.PC);
                    otherSM = sm.getExecutionContext().findObjectProvider(other);
                }
            }

            if (relationType == Relation.MANY_TO_ONE_UNI)
            {
                // Update join table entry
                PersistableRelationStore store =
                    (PersistableRelationStore) storeMgr.getBackingStoreForField(
                        sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
                store.update(sm, otherSM);
            }
        }
    }
View Full Code Here

        ClassLoaderResolver clr = sm.getExecutionContext().getClassLoaderResolver();
        int relationType = mmd.getRelationType(clr);
        if (relationType == Relation.MANY_TO_ONE_UNI)
        {
            // Update join table entry
            PersistableRelationStore store =
                (PersistableRelationStore) storeMgr.getBackingStoreForField(
                    sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
            store.remove(sm);
        }

        // Check if we should delete the related object when this object is deleted
        boolean dependent = mmd.isDependent();
        if (mmd.isCascadeRemoveOrphans())
View Full Code Here

                    Object other = sm.getExecutionContext().persistObjectInternal(pc, null, -1, ObjectProvider.PC);
                    otherSM = sm.getExecutionContext().findObjectProvider(other);
                }

                // Add join table entry
                PersistableRelationStore store =
                    (PersistableRelationStore) storeMgr.getBackingStoreForField(
                        sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
                store.add(sm, otherSM);
            }
        }
    }
View Full Code Here

        if (pc == null)
        {
            if (relationType == RelationType.MANY_TO_ONE_UNI)
            {
                // Update join table entry
                PersistableRelationStore store =
                    (PersistableRelationStore) storeMgr.getBackingStoreForField(
                        sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
                store.remove(sm);
            }

            return;
        }
        else
        {
            ObjectProvider otherSM = sm.getExecutionContext().findObjectProvider(pc);
            if (otherSM == null)
            {
                if (relationType == RelationType.ONE_TO_ONE_BI || relationType == RelationType.MANY_TO_ONE_BI ||
                    relationType == RelationType.MANY_TO_ONE_UNI)
                {
                    // Related object is not yet persisted (e.g 1-1 with FK at other side) so persist it
                    Object other = sm.getExecutionContext().persistObjectInternal(pc, null, -1, ObjectProvider.PC);
                    otherSM = sm.getExecutionContext().findObjectProvider(other);
                }
            }

            if (relationType == RelationType.MANY_TO_ONE_UNI)
            {
                // Update join table entry
                PersistableRelationStore store =
                    (PersistableRelationStore) storeMgr.getBackingStoreForField(
                        sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
                store.update(sm, otherSM);
            }
        }
    }
View Full Code Here

        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(
                    sm.getExecutionContext().getClassLoaderResolver(), mmd, mmd.getType());
            store.remove(sm);
        }

        // Check if we should delete the related object when this object is deleted
        boolean dependent = mmd.isDependent();
        if (mmd.isCascadeRemoveOrphans())
View Full Code Here

     * @return The backing store of this persistable relation in this store
     */
    private PersistableRelationStore getBackingStoreForPersistableRelation(AbstractMemberMetaData mmd,
            ClassLoaderResolver clr, Class type)
    {
        PersistableRelationStore store = null;
        DatastoreContainerObject datastoreTable = getDatastoreContainerObject(mmd);
        store = newPersistableRelationStore(mmd, clr, datastoreTable);
        return store;
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.store.scostore.PersistableRelationStore

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.