Package org.odmg

Examples of org.odmg.Transaction.lock()


            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


        {
            CollectibleA collectible = (CollectibleA) iterator.next();
            Gatherer gat = collectible.getGatherer();
            assertNotNull(gat);
            assertEquals("Gatherer_"+name, gat.getName());
            tx.lock(collectible, Transaction.WRITE);
            collectible.getGatherer().setName("New_"+name);
        }
        tx.commit();

        tx.begin();
View Full Code Here

        {
            CollectibleA collectible = (CollectibleA) iterator.next();
            Gatherer gat = collectible.getGatherer();
            assertNotNull(gat);
            assertEquals("New_"+name, gat.getName());
            tx.lock(collectible, Transaction.WRITE);
            collectible.setGatherer(null);
        }
        tx.commit();

        tx.begin();
View Full Code Here

            kevin.setMother(mum);
            kevin.setFather(dad);

            Transaction tx = odmg.newTransaction();
            tx.begin();
            tx.lock(kevin, Transaction.WRITE);
            tx.commit();

            tx = odmg.newTransaction();
            tx.begin();
            ((HasBroker) tx).getBroker().clearCache();
View Full Code Here

        ODMGGourmet gourmet = (ODMGGourmet)result.get(0);

        /*
        now we lock main object and add a new reference object
        */
        tx.lock(gourmet, Transaction.WRITE);
        gourmet.addFavoriteFood(goldfish);
        tx.commit();

        query = odmg.newOQLQuery();
        query.create("select fishs from " + Fish.class.getName() +
View Full Code Here

        assertEquals(3, gourmet_doris.getFavoriteFood().size());

        /*
        now we lock main object and add remove a reference object
        */
        tx.lock(gourmet_doris, Transaction.WRITE);
        List foodList = gourmet_doris.getFavoriteFood();
        foodList.remove(0);
        //gourmet_doris.setFavoriteFood(foodList);
        tx.commit();

View Full Code Here

    private void storeObject(Object obj) throws Exception
    {
        Transaction tx = odmg.newTransaction();

        tx.begin();
        tx.lock(obj, Transaction.WRITE);
        tx.commit();
    }

    public static synchronized int newThreadKey()
    {
View Full Code Here

        site = new Site();
        site.setName(name);
        site.setYear(new Integer(year));
        site.setSemester(new Integer(semester));

        tx.lock(site, Transaction.WRITE);
        tx.commit();
    }

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

        db.open(databaseName, Database.OPEN_READ_WRITE);
        Site site = new Site();
        site.setName(name);
        Transaction tx = odmg.newTransaction();
        tx.begin();
        tx.lock(site, Transaction.WRITE);
        tx.commit();

        OQLQuery query = odmg.newOQLQuery();
        query.create("select sites from " + Site.class.getName() + " where name=$1");
        query.bind(name);
View Full Code Here

            Site site = new Site();
            site.setName(name);

            Transaction tx = odmg.newTransaction();
            tx.begin();
            tx.lock(site, Transaction.WRITE);
            tx.commit();

            /* Retrieve from the object created, and set the year*/
            OQLQuery query = odmg.newOQLQuery();
            query.create(queryString);
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.