Package org.odmg

Examples of org.odmg.Transaction.lock()


        {
            tx.begin();

            RollbackObjectOne ro = new RollbackObjectOne();
            ro.setName(name);
            tx.lock(ro, Transaction.WRITE);
            // this should fail
            tx.lock(new Exception(), Transaction.WRITE);

            tx.commit();
            fail("A exception was expected");
View Full Code Here


            RollbackObjectOne ro = new RollbackObjectOne();
            ro.setName(name);
            tx.lock(ro, Transaction.WRITE);
            // this should fail
            tx.lock(new Exception(), Transaction.WRITE);

            tx.commit();
            fail("A exception was expected");
        }
        catch(Exception e)
View Full Code Here

            OQLQuery query = odmg.newOQLQuery();
            query.create(strQuery);
            result = (List) query.execute();
            before = result.size();

            tx.lock(child, Transaction.WRITE);
            tx.commit();

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

         */
        Transaction tx = odmg.newTransaction();
        tx.begin();
        ProductGroup group = new ProductGroup();
        group.setGroupName(name);
        tx.lock(group, Transaction.WRITE);
        for (int i = 0; i < COUNT; i++)
        {
            Article article = createArticle(name);
            group.add(article);
        }
View Full Code Here

            //bI should now be a dynamic proxy
            assertTrue(ProxyHelper.isProxy(bI));

            TestClassAWithBProxy a = new TestClassAWithBProxy();
            a.setBProxy(bI);
            tx.lock(a, Transaction.WRITE);
            tx.commit();

            //on commit the foreign key in "a" should have been set to
            //bOid
            String aBOid = a.getBoid();
View Full Code Here

        {
            for (int i = 0; i < arr.length; i++)
            {
                Transaction tx = odmg.newTransaction();
                tx.begin();
                tx.lock(arr[i], Transaction.WRITE);
                m_tx.markDirty(arr[i]);
                tx.commit();
            }
        }
View Full Code Here

        long start = System.currentTimeMillis();
        tx.begin();
        // update all objects
        for(int i = 0; i < articleCount; i++)
        {
            tx.lock(arr[i], Transaction.WRITE);
            arr[i].setPrice(arr[i].getPrice() * 1.95583);
        }
        tx.commit();
        long stop = System.currentTimeMillis();
        logger.info("updating " + articleCount + " Objects: " + (stop - start) + " msec");
View Full Code Here

                    fail("Unexpected exception: " + e.getMessage());
                }
                // use new tx to check released locks for objects
                tx = odmg1.newTransaction();
                tx.begin();
                tx.lock(toBeEdited, Transaction.UPGRADE);
                tx.commit();
            }
            else
            {
                tx.abort();
View Full Code Here

        }
        else
        {
            try
            {
                tx.lock(bean, Transaction.WRITE);
                tx.commit();
            }
            catch(Exception e)
            {
                e.printStackTrace();
View Full Code Here

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

        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(obj_1, Transaction.WRITE);
        tx.lock(obj_2, Transaction.WRITE);
        tx.lock(obj_3, Transaction.WRITE);
        tx.commit();

        Criteria crit = new Criteria();
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.