Package org.odmg

Examples of org.odmg.Implementation.newTransaction()


     * @param product The product to store
     */
    public static void storeProduct(Product product)
    {
        Implementation impl = OJB.getInstance();
        Transaction    tx   = impl.newTransaction();

        tx.begin();
        tx.lock(product, Transaction.WRITE);
        tx.commit();
    }
View Full Code Here


     * @return The product if found
     */
    public static Product findProductByName(String name) throws Exception
    {
        Implementation impl = OJB.getInstance();
        Transaction    tx   = impl.newTransaction();

        tx.begin();

        OQLQuery query = impl.newOQLQuery();

View Full Code Here

     * @param number  The number of items to sell
     */
    public static void sellProduct(Product product, int number)
    {
        Implementation impl = OJB.getInstance();
        Transaction    tx   = impl.newTransaction();

        tx.begin();

        tx.lock(product, Transaction.WRITE);
        product.setStock(product.getStock() -  number);
View Full Code Here

     * @param product The product to delete
     */
    public static void deleteProduct(Product product)
    {
        Implementation impl = OJB.getInstance();
        Transaction    tx = impl.newTransaction();

        tx.begin();

        Database db = impl.getDatabase(product);

View Full Code Here

     * @param product The product to update in the database
     */
    public static void persistChanges(Product product)
    {
        Implementation impl = OJB.getInstance();
        TransactionExt tx  = (TransactionExt)impl.newTransaction();

        tx.begin();
        tx.markDirty(product);
        tx.commit();
    }
View Full Code Here

        // clean up roots map
        clearNRM();

        Article example = createArticle();

        Transaction tx = odmg.newTransaction();
        tx.begin();
        try
        {
            db.bind(example, bindingName);
            Article value = (Article) db.lookup(bindingName);
View Full Code Here

        // get facade instance
        Implementation odmg = OJB.getInstance();
        Database db = odmg.newDatabase();
        //open database
        db.open(databaseName, Database.OPEN_READ_WRITE);
        Transaction tx = odmg.newTransaction();
        tx.begin();
        db.bind(odmg.newDList(), bindingName);

        foundList = (DList)db.lookup(bindingName);
        assertTrue("Could not found bound DList", foundList != null);
View Full Code Here

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

        tx = odmg.newTransaction();
        tx.begin();
        try
        {
            DList newList = (DList)db.lookup(bindingName);
            db.unbind(bindingName);
View Full Code Here

        Database db = odmg.newDatabase();
        db.open(databaseName, Database.OPEN_READ_WRITE);

        // clear named roots.
        clearNRM();
        Transaction tx = odmg.newTransaction();
        //bind object to name
        tx.begin();
        Article example = createArticle();
        Identity oid = new Identity(example, ((HasBroker)tx).getBroker());
View Full Code Here

            fail(ex.getMessage());
        }

        // TestThreadsNLocks look up
        Article lookedUp1 = null;
        tx = odmg.newTransaction();
        tx.begin();

        try
        {
            // lookup by name binding
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.