Package org.odmg

Examples of org.odmg.Transaction.begin()


        List result;
        int before;
        Transaction tx = odmg.newTransaction();
        try
        {
            tx.begin();

            OQLQuery query = odmg.newOQLQuery();
            query.create(strQuery);
            result = (List) query.execute();
            before = result.size();
View Full Code Here


            database.makePersistent(child);

            tx.commit();

            tx.begin();
            query = odmg.newOQLQuery();
            query.create(strQuery);
            result = (List) query.execute();
            tx.commit();
        }
View Full Code Here

        List result;
        int before;

        try
        {
            tx.begin();
            OQLQuery query = odmg.newOQLQuery();
            query.create(strQuery);
            result = (List) query.execute();
            before = result.size();
View Full Code Here

            before = result.size();

            tx.lock(child, Transaction.WRITE);
            tx.commit();

            tx.begin();
            query = odmg.newOQLQuery();
            query.create(strQuery);
            result = (List) query.execute();
            tx.commit();
        }
View Full Code Here

        /*
         * lock only the father, let OJB do the rest
         */
        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(father, Transaction.WRITE);
        tx.commit();

        // without running tx, should not take effect
        father.setChildren(null);
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);
        database.deletePersistent(returnedFather.getChildren()[0]);
        database.deletePersistent(returnedFather.getChildren()[1]);

        tx.commit();
View Full Code Here

        /*
         lock father then all childs
         */
        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(father, Transaction.WRITE);
        tx.lock(child_2, Transaction.WRITE);
        tx.lock(child_1, 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 children then father
         fk-constraints?
         */
        tx.begin();
        database.deletePersistent(returnedFather.getChildren()[0]);
        database.deletePersistent(returnedFather.getChildren()[1]);
        database.deletePersistent(returnedFather);
        tx.commit();

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.