Package org.odmg

Examples of org.odmg.Transaction.lock()


        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();
        crit.addEqualTo("name", name);
View Full Code Here


        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();
        crit.addEqualTo("name", name);
        QueryByCriteria query = QueryFactory.newQuery(MainObject.class, crit);
View Full Code Here

        // add new reference to object
        CollectionReference ref_5 = new CollectionReference(null, "##new ref 1_" + nameRef);
        CollectionReference ref_6 = new CollectionReference(null, "##new ref 2_" + nameRef);
        tx.begin();
        tx.lock(obj_1, Transaction.WRITE);
        tx.lock(obj_2, Transaction.WRITE);
        obj_1.addReference(ref_5);
        obj_2.addReference(ref_6);
        references = obj_2.getAllReferences();
        assertNotNull(references);
View Full Code Here

        // add new reference to object
        CollectionReference ref_5 = new CollectionReference(null, "##new ref 1_" + nameRef);
        CollectionReference ref_6 = new CollectionReference(null, "##new ref 2_" + nameRef);
        tx.begin();
        tx.lock(obj_1, Transaction.WRITE);
        tx.lock(obj_2, Transaction.WRITE);
        obj_1.addReference(ref_5);
        obj_2.addReference(ref_6);
        references = obj_2.getAllReferences();
        assertNotNull(references);
        assertEquals("1 references expected for object: "+obj_2, 1, references.size());
View Full Code Here

        assertEquals(id_1, obj_1.getIdentifier());
        assertEquals(id_2, obj_2.getIdentifier());

        // now update main objects
        tx.begin();
        tx.lock(obj_1, Transaction.WRITE);
        tx.lock(obj_2, Transaction.WRITE);
        obj_1.setName(name+"_update");
        obj_2.setName(name+"_update");
        tx.commit();
View Full Code Here

        assertEquals(id_2, obj_2.getIdentifier());

        // now update main objects
        tx.begin();
        tx.lock(obj_1, Transaction.WRITE);
        tx.lock(obj_2, Transaction.WRITE);
        obj_1.setName(name+"_update");
        obj_2.setName(name+"_update");
        tx.commit();

        obj_1 = (MainObject) broker.getObjectByIdentity(oid_1);
View Full Code Here

        // now update reference
        obj_2 = (MainObject) broker.getObjectByIdentity(oid_2);
        assertNotNull(obj_2);
        tx.begin();
        tx.lock(obj_2, Transaction.WRITE);
        references = obj_2.getAllReferences();
        CollectionReference ref = (CollectionReference) references.get(0);
        tx.lock(ref, Transaction.WRITE);
        ref.setRefName(nameRef+"_update");
        tx.commit();
View Full Code Here

        assertNotNull(obj_2);
        tx.begin();
        tx.lock(obj_2, Transaction.WRITE);
        references = obj_2.getAllReferences();
        CollectionReference ref = (CollectionReference) references.get(0);
        tx.lock(ref, Transaction.WRITE);
        ref.setRefName(nameRef+"_update");
        tx.commit();

        obj_2 = (MainObject) broker.getObjectByIdentity(oid_2);
        assertNotNull(obj_2);
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

        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

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.