Package org.apache.openjpa.jdbc.sql

Examples of org.apache.openjpa.jdbc.sql.RowManagerImpl


        (JDBCStore store, Connection conn) {
        return new PreparedStatementManagerImpl(store, conn);
    }

    protected RowManager newRowManager() {
        return new RowManagerImpl(false);
    }
View Full Code Here


        return new RowManagerImpl(false);
    }

    protected Collection flush(RowManager rowMgr,
        PreparedStatementManager psMgr, Collection exceps) {
        RowManagerImpl rmimpl = (RowManagerImpl) rowMgr;

        // first take care of all secondary table deletes and 'all row' deletes
        // (which are probably secondary table deletes), since no foreign
        // keys ever rely on secondary table pks
        flush(rmimpl.getAllRowDeletes(), psMgr);
        flush(rmimpl.getSecondaryDeletes(), psMgr);

        // now do any 'all row' updates
        flush(rmimpl.getAllRowUpdates(), psMgr);

        // analyze foreign keys
        Collection inserts = rmimpl.getInserts();
        Collection updates = rmimpl.getUpdates();
        Collection deletes = rmimpl.getDeletes();
        Graph[] graphs = new Graph[2];    // insert graph, delete graph
        analyzeForeignKeys(inserts, updates, deletes, rmimpl, graphs);

        // flush insert graph, if any
        boolean autoAssign = rmimpl.hasAutoAssignConstraints();
        try {
            flushGraph(graphs[0], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // flush the rest of the inserts and updates; inserts before updates
        // because some update fks might reference pks that have to be inserted
        flush(inserts, psMgr);
        flush(updates, psMgr);

        // flush the delete graph, if any
        try {
            flushGraph(graphs[1], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // put the remainder of the deletes after updates because some updates
        // may be nulling fks to rows that are going to be deleted
        flush(deletes, psMgr);

        // take care of all secondary table inserts and updates last, since
        // they may rely on previous inserts or updates, but nothing relies
        // on them
        flush(rmimpl.getSecondaryUpdates(), psMgr);

        // flush any left over prepared statements
        psMgr.flush();
        return exceps;
    }
View Full Code Here

        (JDBCStore store, Connection conn) {
        return new PreparedStatementManagerImpl(store, conn);
    }

    protected RowManager newRowManager() {
        return new RowManagerImpl(false);
    }
View Full Code Here

        return new RowManagerImpl(false);
    }

    protected Collection flush(RowManager rowMgr,
        PreparedStatementManager psMgr, Collection exceps) {
        RowManagerImpl rmimpl = (RowManagerImpl) rowMgr;

        // first take care of all secondary table deletes and 'all row' deletes
        // (which are probably secondary table deletes), since no foreign
        // keys ever rely on secondary table pks
        flush(rmimpl.getAllRowDeletes(), psMgr);
        flush(rmimpl.getSecondaryDeletes(), psMgr);

        // now do any 'all row' updates
        flush(rmimpl.getAllRowUpdates(), psMgr);

        // analyze foreign keys
        Collection inserts = rmimpl.getInserts();
        Collection updates = rmimpl.getUpdates();
        Collection deletes = rmimpl.getDeletes();
        Graph[] graphs = new Graph[2];    // insert graph, delete graph
        analyzeForeignKeys(inserts, updates, deletes, rmimpl, graphs);

        // flush insert graph, if any
        boolean autoAssign = rmimpl.hasAutoAssignConstraints();
        try {
            flushGraph(graphs[0], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // flush the rest of the inserts and updates; inserts before updates
        // because some update fks might reference pks that have to be inserted
        flush(inserts, psMgr);
        flush(updates, psMgr);

        // flush the delete graph, if any
        try {
            flushGraph(graphs[1], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // put the remainder of the deletes after updates because some updates
        // may be nulling fks to rows that are going to be deleted
        flush(deletes, psMgr);

        // take care of all secondary table inserts and updates last, since
        // they may rely on previous inserts or updates, but nothing relies
        // on them
        flush(rmimpl.getSecondaryUpdates(), psMgr);

        // flush any left over prepared statements
        psMgr.flush();
        return exceps;
    }
View Full Code Here

    public boolean orderDirty() {
        return true;
    }

    protected RowManager newRowManager() {
        return new RowManagerImpl(true);
    }
View Full Code Here

        return new PreparedStatementManagerImpl(store, conn);
    }

    protected Collection flush(RowManager rowMgr,
        PreparedStatementManager psMgr, Collection exceps) {
        RowManagerImpl rmimpl = (RowManagerImpl) rowMgr;

        // first take care of all secondary table deletes and 'all row' deletes
        // (which are probably secondary table deletes), since no foreign
        // keys ever rely on secondary table pks
        flush(rmimpl.getAllRowDeletes(), psMgr);
        flush(rmimpl.getSecondaryDeletes(), psMgr);

        // now do any 'all row' updates, which typically null keys
        flush(rmimpl.getAllRowUpdates(), psMgr);

        // gather any updates we need to avoid fk constraints on deletes
        Collection constraintUpdates = null;
        for (Iterator itr = rmimpl.getDeletes().iterator(); itr.hasNext();) {
            try {
                constraintUpdates = analyzeDeleteConstraints(rmimpl,
                    (PrimaryRow) itr.next(), constraintUpdates);
            } catch (SQLException se) {
                exceps = addException(exceps, SQLExceptions.getStore
                    (se, dict));
            }
        }
        if (constraintUpdates != null) {
            flush(constraintUpdates, psMgr);
            constraintUpdates.clear();
        }

        // flush primary rows in order
        for (Iterator itr = rmimpl.getOrdered().iterator(); itr.hasNext();) {
            try {
                constraintUpdates = flushPrimaryRow(rmimpl, (PrimaryRow)
                    itr.next(), psMgr, constraintUpdates);
            } catch (SQLException se) {
                exceps = addException(exceps, SQLExceptions.getStore
                    (se, dict));
            }
        }
        if (constraintUpdates != null)
            flush(constraintUpdates, psMgr);

        // take care of all secondary table inserts and updates last, since
        // they may rely on previous inserts or updates, but nothing relies
        // on them
        flush(rmimpl.getSecondaryUpdates(), psMgr);

        // flush any left over prepared statements
        psMgr.flush();
        return exceps;
    }
View Full Code Here

        (JDBCStore store, Connection conn) {
        return new PreparedStatementManagerImpl(store, conn);
    }

    protected RowManager newRowManager() {
        return new RowManagerImpl(false);
    }
View Full Code Here

        return new RowManagerImpl(false);
    }

    protected Collection flush(RowManager rowMgr,
        PreparedStatementManager psMgr, Collection exceps) {
        RowManagerImpl rmimpl = (RowManagerImpl) rowMgr;

        // first take care of all secondary table deletes and 'all row' deletes
        // (which are probably secondary table deletes), since no foreign
        // keys ever rely on secondary table pks
        flush(rmimpl.getAllRowDeletes(), psMgr);
        flush(rmimpl.getSecondaryDeletes(), psMgr);

        // now do any 'all row' updates
        flush(rmimpl.getAllRowUpdates(), psMgr);

        // analyze foreign keys
        Collection<PrimaryRow> inserts = rmimpl.getInserts();
        Collection<PrimaryRow> updates = rmimpl.getUpdates();
        Collection<PrimaryRow> deletes = rmimpl.getDeletes();
   
        Graph[] graphs = new Graph[2];    // insert graph, delete graph
        analyzeForeignKeys(inserts, updates, deletes, rmimpl, graphs);

        // flush insert graph, if any
        boolean autoAssign = rmimpl.hasAutoAssignConstraints();
        try {
            flushGraph(graphs[0], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // flush the rest of the inserts and updates; inserts before updates
        // because some update fks might reference pks that have to be inserted
        flush(inserts, psMgr);
        flush(updates, psMgr);

        // flush the delete graph, if any
        try {
            flushGraph(graphs[1], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // put the remainder of the deletes after updates because some updates
        // may be nulling fks to rows that are going to be deleted
        flush(deletes, psMgr);

        // take care of all secondary table inserts and updates last, since
        // they may rely on previous inserts or updates, but nothing relies
        // on them
        flush(rmimpl.getSecondaryUpdates(), psMgr);

        // flush any left over prepared statements
        psMgr.flush();
        return exceps;
    }
View Full Code Here

        (JDBCStore store, Connection conn) {
        return new PreparedStatementManagerImpl(store, conn);
    }

    protected RowManager newRowManager() {
        return new RowManagerImpl(false);
    }
View Full Code Here

        return new RowManagerImpl(false);
    }

    protected Collection flush(RowManager rowMgr,
        PreparedStatementManager psMgr, Collection exceps) {
        RowManagerImpl rmimpl = (RowManagerImpl) rowMgr;

        // first take care of all secondary table deletes and 'all row' deletes
        // (which are probably secondary table deletes), since no foreign
        // keys ever rely on secondary table pks
        flush(rmimpl.getAllRowDeletes(), psMgr);
        flush(rmimpl.getSecondaryDeletes(), psMgr);

        // now do any 'all row' updates
        flush(rmimpl.getAllRowUpdates(), psMgr);

        // analyze foreign keys
        Collection inserts = rmimpl.getInserts();
        Collection updates = rmimpl.getUpdates();
        Collection deletes = rmimpl.getDeletes();
        Graph[] graphs = new Graph[2];    // insert graph, delete graph
        analyzeForeignKeys(inserts, updates, deletes, rmimpl, graphs);

        // flush insert graph, if any
        boolean autoAssign = rmimpl.hasAutoAssignConstraints();
        try {
            flushGraph(graphs[0], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // flush the rest of the inserts and updates; inserts before updates
        // because some update fks might reference pks that have to be inserted
        flush(inserts, psMgr);
        flush(updates, psMgr);

        // flush the delete graph, if any
        try {
            flushGraph(graphs[1], psMgr, autoAssign);
        } catch (SQLException se) {
            exceps = addException(exceps, SQLExceptions.getStore(se, dict));
        } catch (OpenJPAException ke) {
            exceps = addException(exceps, ke);
        }

        // put the remainder of the deletes after updates because some updates
        // may be nulling fks to rows that are going to be deleted
        flush(deletes, psMgr);

        // take care of all secondary table inserts and updates last, since
        // they may rely on previous inserts or updates, but nothing relies
        // on them
        flush(rmimpl.getSecondaryUpdates(), psMgr);

        // flush any left over prepared statements
        psMgr.flush();
        return exceps;
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.sql.RowManagerImpl

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.