Package org.odmg

Examples of org.odmg.Transaction.commit()


        Transaction tx = odmg.newTransaction();
        tx.begin();
        testProductGroup = new ProductGroup();
        testProductGroup.setGroupName("NamedRootsTest_" + System.currentTimeMillis());
        database.makePersistent(testProductGroup);
        tx.commit();
    }

    private Article createArticle()
    {
        Article example = new Article();
View Full Code Here


        database.bind(article, bindingName);
        foundArticle = (Article) database.lookup(bindingName);

        foundArticle = null;
        tx.commit();

        tx = odmg.newTransaction();
        tx.begin();
        foundArticle = (Article) database.lookup(bindingName);
        assertNotNull(foundArticle);
View Full Code Here

        tx = odmg.newTransaction();
        tx.begin();
        foundArticle = (Article) database.lookup(bindingName);
        assertNotNull(foundArticle);
        database.unbind(bindingName);
        tx.commit();
    }


    public void testLookup() throws Exception
    {
View Full Code Here

        Transaction tx = odmg.newTransaction();
        //bind object to name
        tx.begin();
        Article example = createArticle();
        database.makePersistent(example);
        tx.commit();

        // 1. perform binding
        tx.begin();
        try
        {
View Full Code Here

        // 1. perform binding
        tx.begin();
        try
        {
            database.bind(example, name);
            tx.commit();
        }
        catch (ObjectNameNotUniqueException ex)
        {
            tx.abort();
            fail(ex.getMessage());
View Full Code Here

        tx = odmg.newTransaction();
        tx.begin();
        try
        {
            database.unbind(name);
            tx.commit();
        }
        catch (ObjectNameNotFoundException ex)
        {
            tx.abort();
            fail("name " + name + "should be known");
View Full Code Here

        Transaction tx = odmg.newTransaction();
        tx.begin();
        productGroup = new ProductGroup();
        productGroup.setName("DMapTest_" + System.currentTimeMillis() + "_");
        database.makePersistent(productGroup);
        tx.commit();
    }

    protected Article createArticle(String name) throws Exception
    {
View Full Code Here

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

        tx.begin();
        // query test objects
        OQLQuery q = odmg.newOQLQuery();
        q.create("select all from "+DObject.class.getName()+" where name=$1");
View Full Code Here

            tx.lock(it.next(), Transaction.READ);
        }
        // create new list for results
        ArrayList result = new ArrayList();
        result.addAll(ret);
        tx.commit();
    }

    public void testIterateWithoutTx() throws Exception
    {
        // create a unique name:
View Full Code Here

            DObject a = createObject(name);
            list.add(a);
        }
        // bind the new list
        database.bind(list, name);
        tx.commit();

        tx = odmg.newTransaction();
        tx.begin();
        Object obj = database.lookup(name);
        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.