Package org.odmg

Examples of org.odmg.Transaction.lock()


        database.makePersistent(a);
        database.makePersistent(b);
        tx.commit();

        tx.begin();
        tx.lock(a, Transaction.WRITE);
        tx.lock(b, Transaction.WRITE);
        a.setRelatedB(b);
        b.setRelatedA(a);
        tx.commit();
View Full Code Here


        /* One possibility of storing objects is to use the current transaction
         associated with the container */
        Transaction tx = odmg.currentTransaction();
        for (Iterator iterator = objects.iterator(); iterator.hasNext();)
        {
            tx.lock(iterator.next(), Transaction.WRITE);
        }
        return objects;
    }

    /**
 
View Full Code Here

        database.makePersistent(b);
        tx.commit();

        tx.begin();
        tx.lock(a, Transaction.WRITE);
        tx.lock(b, Transaction.WRITE);
        a.setRelatedB(b);
        b.setRelatedA(a);
        tx.commit();

         /**
 
View Full Code Here

        {
            b = (ObjectB)it.next();
            a = b.getRelatedA();
            if (a != null)
            {
                tx.lock(a, Transaction.WRITE);
                a.setRelatedB(null);    // break relationship to avoid ri violation
            }
            database.deletePersistent(b);
        }
View Full Code Here

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

        tx = odmg.newTransaction();
View Full Code Here

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

        tx = odmg.newTransaction();
        tx.begin();
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();

        tx = odmg.newTransaction();
        tx.begin();
        // make sure all objects are retrieved freshly in subsequent transactions
View Full Code Here

            /* One possibility of storing objects is to use the current transaction
             associated with the container */
            Transaction tx = odmg.currentTransaction();
            for (Iterator iterator = objects.iterator(); iterator.hasNext();)
            {
                tx.lock(iterator.next(), Transaction.WRITE);
            }
        }
        catch (LockNotGrantedException e)
        {
            log.error("Failure while storing objects " + objects, e);
View Full Code Here

        Transaction tx = odmg.newTransaction();
        tx.begin();
        // add objects to list
        for (int i = 0; i < 5; i++)
        {
            tx.lock(createObject(name), Transaction.WRITE);
        }
        tx.commit();

        tx.begin();
        // query test objects
View Full Code Here

        // check result list size
        assertEquals(5, ret.size());
        // do read lock
        for (Iterator it = ret.iterator(); it.hasNext(); )
        {
            tx.lock(it.next(), Transaction.READ);
        }
        // create new list for results
        ArrayList result = new ArrayList();
        result.addAll(ret);
        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.