Package org.datanucleus.store.exceptions

Examples of org.datanucleus.store.exceptions.NotYetFlushedException


            {
                sm.setStoringPC();
            }

            int n = 0;
            NotYetFlushedException notYetFlushed = null;
            for (int i=0; i<javaTypeMappings.length; i++)
            {
                // Set the PreparedStatement positions for this implementation mapping
                int[] posMapping;
                if (n >= pos.length)
View Full Code Here


                    if (ec.isInserting(value))
                    {
                        // Object is in the process of being inserted, but has no id yet so provide a null for now
                        // The "NotYetFlushedException" is caught by ParameterSetter and processed as an update being required.
                        getDatastoreMapping(0).setObject(ps, param[0], null);
                        throw new NotYetFlushedException(value);
                    }
                    else
                    {
                        // Object is not persist, nor in the process of being made persistent
                        ec.persistObjectInternal(value, null, -1, ObjectProvider.PC);
View Full Code Here

                        }
                    }
                    catch (NotYetFlushedException e)
                    {
                        setObjectAsNull(ec, ps, param);
                        throw new NotYetFlushedException(value);
                    }
                }

                if (valueSM != null)
                {
                    valueSM.setStoringPC();
                }

                // If the field doesn't map to any datastore fields, omit the set process
                if (getNumberOfDatastoreMappings() > 0)
                {
                    if (id instanceof OID)
                    {
                        super.setObject(ec, ps, param, id);
                    }
                    else
                    {
                        // TODO Factor out this PersistenceCapable reference
                        ((PersistenceCapable)value).jdoCopyKeyFieldsFromObjectId(
                            new AppIDObjectIdFieldConsumer(param, ec, ps, javaTypeMappings), id);
                    }
                }
            }
            else
            {
                if (valueSM != null)
                {
                    valueSM.setStoringPC();
                }

                if (getNumberOfDatastoreMappings() > 0)
                {
                    // Object is in the process of being inserted so we cant use its id currently and we need to store
                    // a foreign key to it (which we cant yet do). Just put "null" in and throw "NotYetFlushedException",
                    // to be caught by ParameterSetter and will signal to the PC object being inserted that it needs
                    // to inform this object when it is inserted.
                    setObjectAsNull(ec, ps, param);
                    throw new NotYetFlushedException(value);
                }
            }
        }
        finally
        {
View Full Code Here

                    if (ec.isInserting(value))
                    {
                        // Object is in the process of being inserted, but has no id yet so provide a null for now
                        // The "NotYetFlushedException" is caught by ParameterSetter and processed as an update being required.
                        getDatastoreMapping(0).setObject(ps, param[0], null);
                        throw new NotYetFlushedException(value);
                    }
                    else
                    {
                        // Object is not persist, nor in the process of being made persistent
                        ec.persistObjectInternal(value, null, -1, ObjectProvider.PC);
View Full Code Here

            {
                op.setStoringPC();
            }

            int n = 0;
            NotYetFlushedException notYetFlushed = null;
            for (int i=0; i<javaTypeMappings.length; i++)
            {
                // Set the PreparedStatement positions for this implementation mapping
                int[] posMapping;
                if (setValueFKOnly)
View Full Code Here

                        }
                    }
                    catch (NotYetFlushedException e)
                    {
                        setObjectAsNull(ec, ps, param);
                        throw new NotYetFlushedException(value);
                    }
                }

                if (valueSM != null)
                {
                    valueSM.setStoringPC();
                }

                // If the field doesn't map to any datastore fields (e.g remote FK), omit the set process
                if (getNumberOfDatastoreMappings() > 0)
                {
                    if (id instanceof OID)
                    {
                        OID oid = (OID)id;
                        try
                        {
                            // Try as a Long
                            getDatastoreMapping(0).setObject(ps, param[0], oid.getKeyValue());
                        }
                        catch (Exception e)
                        {
                            // Must be a String
                            getDatastoreMapping(0).setObject(ps, param[0], oid.getKeyValue().toString());
                        }
                    }
                    else
                    {
                        boolean fieldsSet = false;
                        if (api.isSingleFieldIdentity(id) && javaTypeMappings.length > 1)
                        {
                            Object key = api.getTargetKeyForSingleFieldIdentity(id);
                            AbstractClassMetaData keyCmd = ec.getMetaDataManager().getMetaDataForClass(key.getClass(), clr);
                            if (keyCmd != null && keyCmd.getIdentityType() == IdentityType.NONDURABLE)
                            {
                                // Embedded ID - Make sure these are called starting at lowest first, in order
                                // We cannot just call OP.provideFields with all fields since that does last first
                                ObjectProvider keyOP = ec.findObjectProvider(key);
                                int[] fieldNums = keyCmd.getAllMemberPositions();
                                FieldManager fm = new AppIDObjectIdFieldManager(param, ec, ps, javaTypeMappings);
                                for (int i=0;i<fieldNums.length;i++)
                                {
                                    keyOP.provideFields(new int[] {fieldNums[i]}, fm);
                                }
                                fieldsSet = true;
                            }
                        }

                        if (!fieldsSet)
                        {
                            // TODO Factor out this PersistenceCapable reference
                            ((PersistenceCapable)value).jdoCopyKeyFieldsFromObjectId(
                                new AppIDObjectIdFieldManager(param, ec, ps, javaTypeMappings), id);
                        }
                    }
                }
            }
            else
            {
                if (valueSM != null)
                {
                    valueSM.setStoringPC();
                }

                if (getNumberOfDatastoreMappings() > 0)
                {
                    // Object is in the process of being inserted so we cant use its id currently and we need to store
                    // a foreign key to it (which we cant yet do). Just put "null" in and throw "NotYetFlushedException",
                    // to be caught by ParameterSetter and will signal to the PC object being inserted that it needs
                    // to inform this object when it is inserted.
                    setObjectAsNull(ec, ps, param);
                    throw new NotYetFlushedException(value);
                }
            }
        }
        finally
        {
View Full Code Here

            {
                sm.setStoringPC();
            }

            int n = 0;
            NotYetFlushedException notYetFlushed = null;
            for (int i=0; i<javaTypeMappings.length; i++)
            {
                // Set the PreparedStatement positions for this implementation mapping
                int[] posMapping;
                if (n >= pos.length)
View Full Code Here

                        }
                    }
                    catch (NotYetFlushedException e)
                    {
                        setObjectAsNull(om, ps, param);
                        throw new NotYetFlushedException(value);
                    }
                }

                if (sm != null)
                {
                    sm.setStoringPC();
                }

                // If the field doesnt map to any datastore fields, omit the set process
                if (getNumberOfDatastoreFields() > 0)
                {
                    if (id instanceof OID)
                    {
                        super.setObject(om, ps, param, id);
                    }
                    else
                    {
                        // TODO Factor out this PersistenceCapable reference
                        ((PersistenceCapable)value).jdoCopyKeyFieldsFromObjectId(new AppIDObjectIdFieldConsumer(param, om, ps,
                            javaTypeMappings), id);
                    }
                }
            }
            else
            {
                if (sm != null)
                {
                    sm.setStoringPC();
                }

                if (getNumberOfDatastoreFields() > 0)
                {
                    // Object is in the process of being inserted so we cant use its id currently and we need to store
                    // a foreign key to it (which we cant yet do). Just put "null" in and throw "NotYetFlushedException",
                    // to be caught by ParameterSetter and will signal to the PC object being inserted that it needs
                    // to inform this object when it is inserted.
                    setObjectAsNull(om, ps, param);
                    throw new NotYetFlushedException(value);
                }
            }
        }
        finally
        {
View Full Code Here

                    if (om.isInserting(value))
                    {
                        // Object is in the process of being inserted, but has no id yet so provide a null for now
                        // The "NotYetFlushedException" is caught by ParameterSetter and processed as an update being required.
                        getDataStoreMapping(0).setObject(ps, param[0], null);
                        throw new NotYetFlushedException(value);
                    }
                    else
                    {
                        // Object is not persist, nor in the process of being made persistent
                        om.persistObjectInternal(value, null, null, -1, StateManager.PC);
View Full Code Here

TOP

Related Classes of org.datanucleus.store.exceptions.NotYetFlushedException

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.