Package org.odmg

Examples of org.odmg.Transaction.lock()


            List result = (List) query.execute();
            assertEquals(1, result.size());
            site = (Site) result.get(0);
            assertNotNull(site);
            assertNull(site.getYear());
            tx.lock(site, Transaction.UPGRADE);
            site.setYear(new Integer(2003));

            tx.commit();

            /* Flush the cache, and retrieve the object again */
 
View Full Code Here


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

        while (it.hasNext())
        {
            Article article = createArticle(i++);
            article.setArticleName("OneToManyUpdateTest");
            temp = (InterfaceProductGroup) it.next();
            tx.lock(temp, Transaction.WRITE);
            temp.add(article);
            article.setProductGroup(temp);
        }
        tx.commit(); // thma: during this commit no article is persisted! works as designed!
View Full Code Here

            //get a dynamic proxy object
            TestClassBProxy b = new TestClassBProxy();
            new Identity(b,((HasBroker)tx).getBroker());


            tx.lock(b, Transaction.WRITE);
            tx.commit();
            String bOid = b.getOid();

            //reload the object created in the previous step
            tx = odmg.newTransaction();
View Full Code Here

            //bI should now be a dynamic proxy
            assertTrue(bI instanceof Proxy);

            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

        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

        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

        /**
         * do the reassignment
         */
        tx.begin();
        tx.lock(version, Transaction.WRITE);
        tx.lock(version2, Transaction.WRITE);
        version.setContract(contract2);
        version2.setContract(contract);
        tx.commit();

View Full Code Here

        /**
         * do the reassignment
         */
        tx.begin();
        tx.lock(version, Transaction.WRITE);
        tx.lock(version2, Transaction.WRITE);
        version.setContract(contract2);
        version2.setContract(contract);
        tx.commit();

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