Package org.odmg

Examples of org.odmg.Transaction.begin()


         TODO: Does not pass - why? A defined lock
         order necessary?
         if this doesn't make sense remove the test
         */
        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(child_1, Transaction.WRITE);
        tx.lock(child_2, Transaction.WRITE);
        tx.lock(father, Transaction.WRITE);
        tx.commit();

View Full Code Here


        // without running tx, should not take effect
        father.setChildren(null);
        father.setFirstname(null);

        tx.begin();
        // make sure all objects are retrieved freshly in subsequent transactions
        ((TransactionImpl) tx).getBroker().clearCache();
        OQLQuery qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameFather);
View Full Code Here

        /*
         delete father then children
         fk-constraints?
         */
        tx.begin();
        database.deletePersistent(returnedFather.getChildren()[0]);
        database.deletePersistent(returnedFather.getChildren()[1]);
        database.deletePersistent(returnedFather);
        tx.commit();

View Full Code Here

        int odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
        int projectsBefore = getDBObjectCountWithNewPB(Project.class);

        Transaction tx = odmg.newTransaction();
        tx.begin();
        //store
        persistentStoreObjects(database, getNewODMGZoos("testResultsAfterTransaction", 5));
        persistentStoreObjects(database, getNewProjects("testResultsAfterTransaction", 3));
        //store more
        storeObjects(tx, getNewODMGZoos("testResultsAfterTransaction", 5));
View Full Code Here

        //we do twice
        odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
        projectsBefore = getDBObjectCountWithNewPB(Project.class);

        //tx should be reusable
        tx.begin();
        //store
        persistentStoreObjects(database, getNewODMGZoos("testResultsAfterTransaction", 5));
        persistentStoreObjects(database, getNewProjects("testResultsAfterTransaction", 3));
        //store more
        storeObjects(tx, getNewODMGZoos("testResultsAfterTransaction", 5));
View Full Code Here

    {
        int odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
        int projectsBefore = getDBObjectCountWithNewPB(Project.class);

        Transaction tx = odmg.newTransaction();
        tx.begin();
        //store
        persistentStoreObjects(database, getNewODMGZoos("testResultsAfterTransactionWithClearedCache", 5));
        persistentStoreObjects(database, getNewProjects("testResultsAfterTransactionWithClearedCache", 3));
        //store more
        storeObjects(tx, getNewODMGZoos("testResultsAfterTransactionWithClearedCache", 5));
View Full Code Here

        //we do twice
        odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
        projectsBefore = getDBObjectCountWithNewPB(Project.class);

        //tx should be reusable
        tx.begin();
        //store
        persistentStoreObjects(database, getNewODMGZoos("testResultsAfterTransactionWithClearedCache", 5));
        persistentStoreObjects(database, getNewProjects("testResultsAfterTransactionWithClearedCache", 3));
        //store more
        storeObjects(tx, getNewODMGZoos("testResultsAfterTransactionWithClearedCache", 5));
View Full Code Here

    {
        int odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
        int projectsBefore = getDBObjectCountWithNewPB(Project.class);

        Transaction tx = odmg.newTransaction();
        tx.begin();
        storeObjects(tx, getNewODMGZoos("testUserRollback", 10));
        storeObjects(tx, getNewProjects("testUserRollback", 10));
        //we abort tx
        tx.abort();
View Full Code Here

        //We do this twice
        odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
        projectsBefore = getDBObjectCountWithNewPB(Project.class);

        tx.begin();
        storeObjects(tx, getNewODMGZoos("testUserRollback", 10));
        storeObjects(tx, getNewProjects("testUserRollback", 10));
        //we abort tx
        tx.abort();
View Full Code Here

    {
        int odmgZoosBefore = getDBObjectCountWithNewPB(ODMGZoo.class);
        int projectsBefore = getDBObjectCountWithNewPB(Project.class);

        Transaction tx = odmg.newTransaction();
        tx.begin();
        storeObjects(tx, getNewODMGZoos("testUserRollbackWithCheckpoint", 10));
        // now we store objects to DB
        tx.checkpoint();
        storeObjects(tx, getNewProjects("testUserRollbackWithCheckpoint", 10));
        //we abort tx, all actions after the last checkpoint call should be rollback
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.