Package org.odmg

Examples of org.odmg.Transaction.begin()


        final String name = "testAdding_" + System.currentTimeMillis();

        // get DList and fill with objects
        DList list = odmg.newDList();
        Transaction tx = odmg.newTransaction();
        tx.begin();
        for (int i = 0; i < 5; i++)
        {
            DObject a = createObject(name);
            list.add(a);
        }
View Full Code Here


        // bind the new list
        database.bind(list, name);
        tx.commit();

        tx = odmg.newTransaction();
        tx.begin();
        Object obj = database.lookup(name);
        tx.commit();
        assertNotNull("binded DList not found", obj);

        // iterate list
View Full Code Here

            assertNotNull(a);
        }
        assertEquals(5, list.size());

        tx = odmg.newTransaction();
        tx.begin();
        ((TransactionExt) odmg.currentTransaction()).getBroker().clearCache();
        DList lookedUp = (DList) database.lookup(name);
        tx.commit();
        assertNotNull("binded DList not found", lookedUp);
View Full Code Here

    {
        // create a unique name:
        String name = "testRemoving_" + System.currentTimeMillis();

        Transaction tx = odmg.newTransaction();
        tx.begin();
        DList list = odmg.newDList();
        // bind the list to the name:
        database.bind(list, name);

        for (int i = 0; i < 5; i++)
View Full Code Here

        assertEquals(5, list.size());
        tx.commit();

        // delete two items
        tx = odmg.newTransaction();
        tx.begin();
        ((HasBroker) odmg.currentTransaction()).getBroker().clearCache();
        DList lookedUp = (DList) database.lookup(name);
        assertNotNull("database lookup does not find the named DList", lookedUp);
        assertEquals("Wrong number of list entries", 5, lookedUp.size());
        lookedUp.remove(2);
View Full Code Here

        lookedUp.remove(1);
        tx.commit();

        // check if deletion was successful
        tx = odmg.newTransaction();
        tx.begin();
        ((HasBroker) odmg.currentTransaction()).getBroker().clearCache();
        lookedUp = (DList) database.lookup(name);
        tx.commit();

        assertEquals(3, lookedUp.size());
View Full Code Here

    {
        // create a unique name:
        String name = "testAddingWithIndex_" + System.currentTimeMillis();

        Transaction tx = odmg.newTransaction();
        tx.begin();
        DList list = odmg.newDList();
        database.bind(list, name);
        tx.commit();

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

        DList list = odmg.newDList();
        database.bind(list, name);
        tx.commit();

        tx = odmg.newTransaction();
        tx.begin();
        for (int i = 0; i < 5; i++)
        {
            DObject a = createObject(name);
            list.add(a);
        }
View Full Code Here

        list.add(2, createObject(name+"_pos2"));
        list.add(0, createObject(name+"_pos0"));
        list.add(7, createObject(name+"_pos7"));
        tx.commit();

        tx.begin();
        ((TransactionImpl) tx).getBroker().clearCache();
        // System.out.println("list: " + list);
        // System.out.println("lookup list: " + db.lookup(name));
        tx.commit();
View Full Code Here

            //System.out.print(a.getArticleId() + ", ");
        }


        tx = odmg.newTransaction();
        tx.begin();
        ((TransactionImpl) tx).getBroker().clearCache();
        DList lookedUp = (DList) database.lookup(name);
        // System.out.println("lookup list: " + lookedUp);
        assertNotNull("database lookup does not find DList", lookedUp);
        assertEquals(8, lookedUp.size());
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.