Package org.odmg

Examples of org.odmg.Transaction.commit()


        // 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

        query.bind(name);

        DList   results = (DList)query.execute();
        Product product = (Product)results.iterator().next();

        tx.commit();
        return product;
    }

    /**
     * Sells the given amount of products.
View Full Code Here

        tx.begin();

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

        tx.commit();
    }

    /**
     * Deletes the given product from the database.
     *
 
View Full Code Here

        Database db = impl.getDatabase(product);

        db.deletePersistent(product);

        tx.commit();
    }

    /**
     * Stores any changes to the product in the database.
     *
 
View Full Code Here

            query.create("select allproducts from " + Product.class.getName());

            // 4. perform the query and store the result in a persistent Collection
            DList allProducts = (DList) query.execute();

            tx.commit();

            // 5. now iterate over the result to print each product
            for (Iterator iter = allProducts.iterator(); iter.hasNext();)
            {
                System.out.println(iter.next());
View Full Code Here

        try
        {
            db.bind(example, bindingName);
            Article value = (Article) db.lookup(bindingName);
            assertTrue("Could not lookup object for binding name: "+bindingName, value != null);
            tx.commit();
        }
        catch (ObjectNameNotFoundException ex)
        {
            // tx.abort();
            fail("name " + bindingName + " should not be unknown. "+ex.getMessage());
View Full Code Here

        try
        {
            tx.begin();
            db.bind(example, bindingName);
            tx.commit();
            fail("We expected a ObjectNameNotUniqueException, but was not thrown");
        }
        catch (ObjectNameNotUniqueException ex)
        {
            // we wait for this exception
View Full Code Here

        try
        {
            tx.begin();
            db.unbind(bindingName);
            tx.commit();
        }
        catch (ObjectNameNotFoundException ex)
        {
            fail("Can't unbind " + bindingName + ": "+ex.getMessage());
        }
View Full Code Here

        catch (ObjectNameNotFoundException ex)
        {
            fail("Could not found bound DList, binding name was: "+bindingName);
        }
        foundList = null;
        tx.commit();

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