Package org.odmg

Examples of org.odmg.Transaction.lock()


        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

        Transaction tx = odmg.newTransaction();

        tx.begin();

        // 4. acquire write lock on new object
        tx.lock(newProduct, Transaction.WRITE);

        // 5. commit transaction
        tx.commit();
    }
}
View Full Code Here

    {
        Implementation impl = OJB.getInstance();
        Transaction    tx   = impl.newTransaction();

        tx.begin();
        tx.lock(product, Transaction.WRITE);
        tx.commit();
    }

    /**
     * Finds the product with the given name.
View Full Code Here

        Implementation impl = OJB.getInstance();
        Transaction    tx   = impl.newTransaction();

        tx.begin();

        tx.lock(product, Transaction.WRITE);
        product.setStock(product.getStock() -  number);

        tx.commit();
    }
View Full Code Here

            Master master_1 = populatedMasterFKinPK(tx, 7, timestamp);
            Master master_2 = populatedMasterFKinPK(tx, 6, timestamp);
            Master master_3 = populatedMasterFKnoPK(tx, 7, timestamp);
            Master master_4 = populatedMasterFKnoPK(tx, 6, timestamp);

            tx.lock(master_1, Transaction.WRITE);
            tx.lock(master_2, Transaction.WRITE);
            tx.lock(master_3, Transaction.WRITE);
            tx.lock(master_4, Transaction.WRITE);
            tx.commit();
View Full Code Here

            Master master_2 = populatedMasterFKinPK(tx, 6, timestamp);
            Master master_3 = populatedMasterFKnoPK(tx, 7, timestamp);
            Master master_4 = populatedMasterFKnoPK(tx, 6, timestamp);

            tx.lock(master_1, Transaction.WRITE);
            tx.lock(master_2, Transaction.WRITE);
            tx.lock(master_3, Transaction.WRITE);
            tx.lock(master_4, Transaction.WRITE);
            tx.commit();

            tx.begin();
View Full Code Here

            Master master_3 = populatedMasterFKnoPK(tx, 7, timestamp);
            Master master_4 = populatedMasterFKnoPK(tx, 6, timestamp);

            tx.lock(master_1, Transaction.WRITE);
            tx.lock(master_2, Transaction.WRITE);
            tx.lock(master_3, Transaction.WRITE);
            tx.lock(master_4, Transaction.WRITE);
            tx.commit();

            tx.begin();
            OQLQuery query = odmg.newOQLQuery();
View Full Code Here

            Master master_4 = populatedMasterFKnoPK(tx, 6, timestamp);

            tx.lock(master_1, Transaction.WRITE);
            tx.lock(master_2, Transaction.WRITE);
            tx.lock(master_3, Transaction.WRITE);
            tx.lock(master_4, Transaction.WRITE);
            tx.commit();

            tx.begin();
            OQLQuery query = odmg.newOQLQuery();
            query.create("select masters from " + Master.class.getName() + " where masterText like $1");
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

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.