Package org.odmg

Examples of org.odmg.Transaction.commit()


            tx.begin();
            query = odmg.newOQLQuery();
            query.create(strQuery);
            result = (List) query.execute();
            tx.commit();
        }
        finally
        {
            if (tx != null && tx.isOpen())
            {
View Full Code Here


            query.create(strQuery);
            result = (List) query.execute();
            before = result.size();

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

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

            tx.begin();
            query = odmg.newOQLQuery();
            query.create(strQuery);
            result = (List) query.execute();
            tx.commit();
        }
        finally
        {
            if (tx != null && tx.isOpen())
            {
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);
        father.setFirstname(null);

View Full Code Here

        assertEquals(
                "children's names are equal",
                Arrays.asList(getFirstNames(returnedChildren)),
                Arrays.asList(getFirstNames(children)));
        // System.out.println(Arrays.asList(getFirstNames(returnedChildren)));
        tx.commit();

        /*
         delete father then children
         fk-constraints?
         */
 
View Full Code Here

        tx.begin();
        database.deletePersistent(returnedFather);
        database.deletePersistent(returnedFather.getChildren()[0]);
        database.deletePersistent(returnedFather.getChildren()[1]);

        tx.commit();

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameFather);
        result = (Collection) qry.execute();
View Full Code Here

        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();

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

        assertEquals(
                "children's names are equal",
                Arrays.asList(getFirstNames(returnedChildren)),
                Arrays.asList(getFirstNames(children)));
        // System.out.println(Arrays.asList(getFirstNames(returnedChildren)));
        tx.commit();

        /*
         delete children then father
         fk-constraints?
         */
 
View Full Code Here

         */
        tx.begin();
        database.deletePersistent(returnedFather.getChildren()[0]);
        database.deletePersistent(returnedFather.getChildren()[1]);
        database.deletePersistent(returnedFather);
        tx.commit();

        qry = odmg.newOQLQuery();
        qry.create("select a from " + PersonImpl.class.getName() + " where firstname=$1");
        qry.bind(firstnameFather);
        result = (Collection) qry.execute();
View Full Code Here

        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();

        // without running tx, should not take effect
        father.setChildren(null);
        father.setFirstname(null);
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.