Package org.datanucleus.store

Examples of org.datanucleus.store.ObjectProvider


                            Object obj = ec.findObject(api.getIdForObject(object), true, false, object.getClass().getName());
                            if (obj != null)
                            {
                                // PM.getObjectById creates a dummy object to represent this object and automatically
                                // enlists it in the txn. Evict it to avoid issues with reachability
                                ObjectProvider objSM = ec.findObjectProvider(obj);
                                if (objSM != null)
                                {
                                    ec.evictFromTransaction(objSM);
                                }
                            }
                            exists = true;
                        }
                        catch (NucleusObjectNotFoundException onfe)
                        {
                            exists = false;
                        }
                    }
                }
                if (!exists)
                {
                    // Persist the object
                    ec.persistObjectInternal(object, fieldValues, ObjectProvider.PC);
                    persisted = true;
                }
            }
            else
            {
                // Persistent, but is it flushed to the datastore?
                ObjectProvider objectSM = ec.findObjectProvider(object);
                if (objectSM.isWaitingToBeFlushedToDatastore())
                {
                    // Newly persistent but still not flushed (e.g in optimistic txn)
                    // Process any fieldValues
                    if (fieldValues != null)
                    {
                        objectSM.loadFieldValues(fieldValues);
                    }

                    // Now flush it
                    objectSM.flush();
                }
            }
        }
        return persisted;
    }
View Full Code Here


                ExecutionContext ec = ownerSM.getExecutionContext();
                Iterator iter = c.iterator();
                while (iter.hasNext())
                {
                    Object pc = iter.next();
                    ObjectProvider objSM = ec.findObjectProvider(pc);
                    if (objSM == null)
                    {
                        objSM = ObjectProviderFactory.newForEmbedded(ec, pc, false, ownerSM, fieldNumber);
                    }
                }
View Full Code Here

                ExecutionContext ec = ownerSM.getExecutionContext();
                Iterator iter = c.iterator();
                while (iter.hasNext())
                {
                    Object pc = iter.next();
                    ObjectProvider objSM = ec.findObjectProvider(pc);
                    if (objSM == null)
                    {
                        objSM = ObjectProviderFactory.newForEmbedded(ec, pc, false, ownerSM, fieldNumber);
                    }
                }
View Full Code Here

        }

        if (om.getApiAdapter().isTransactional(pc))
        {
            // transactional instances are not validated, so we check if a deleted instance has been flushed
            ObjectProvider sm = om.findObjectProvider(pc);
            if (om.getApiAdapter().isDeleted(pc))
            {
                try
                {
                    sm.locate();
                }
                catch (NucleusObjectNotFoundException ex)
                {
                    // the instance has been flushed, and it was not found, so we return null
                    return null;
View Full Code Here

        if (om.getApiAdapter().isDetached(entity))
        {
            throw new IllegalArgumentException(LOCALISER.msg("EM.EntityIsNotManaged", StringUtils.toJVMIDString(entity)));
        }

        ObjectProvider sm = om.findObjectProvider(entity);
        return getJPALockModeTypeForLockType(sm.getLockMode());
    }
View Full Code Here

        ExecutionContext ec = nucleusCtx.getApiAdapter().getExecutionContext(entity);
        if (ec == null)
        {
            return false;
        }
        ObjectProvider sm = ec.findObjectProvider(entity);
        if (sm == null)
        {
            // Not managed
            return false;
        }
View Full Code Here

            return dirtyFieldNames;
        }
        else
        {
            ExecutionContext ec = ((JDOPersistenceManager)pm).getObjectManager();
            ObjectProvider sm = ec.findObjectProvider(pc);
            if (sm == null)
            {
                return null;
            }
            return sm.getDirtyFieldNames();
        }
    }
View Full Code Here

            return loadedFieldNames;
        }
        else
        {
            ExecutionContext ec = ((JDOPersistenceManager)pm).getObjectManager();
            ObjectProvider sm = ec.findObjectProvider(pc);
            if (sm == null)
            {
                return null;
            }
            return sm.getLoadedFieldNames();
        }
    }
View Full Code Here

            return loaded;
        }
        else
        {
            ExecutionContext ec = ((JDOPersistenceManager)pc.jdoGetPersistenceManager()).getObjectManager();
            ObjectProvider sm = ec.findObjectProvider(pc);
            if (sm == null)
            {
                return null;
            }
            int position = sm.getClassMetaData().getAbsolutePositionOfMember(memberName);
            return sm.isFieldLoaded(position);
        }
    }
View Full Code Here

            return dirtyFieldNumbers[position];
        }
        else
        {
            ExecutionContext ec = ((JDOPersistenceManager)pc.jdoGetPersistenceManager()).getObjectManager();
            ObjectProvider sm = ec.findObjectProvider(pc);
            if (sm == null)
            {
                return null;
            }
            int position = sm.getClassMetaData().getAbsolutePositionOfMember(memberName);
            boolean[] dirtyFieldNumbers = sm.getDirtyFields();
            return dirtyFieldNumbers[position];
        }
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.store.ObjectProvider

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.