Package org.odmg

Examples of org.odmg.Transaction.begin()


        long timestamp = System.currentTimeMillis();
        try
        {
            // 2. Get a list of all Masters
            Transaction tx = odmg.newTransaction();
            tx.begin();
            // 1. Insert some objects into the database, some of them with
            // details in DetailFKinPK, some of them in DetailFKnoPK
            Master master_1 = populatedMasterFKinPK(tx, 7, timestamp);
            Master master_2 = populatedMasterFKinPK(tx, 6, timestamp);
            Master master_3 = populatedMasterFKnoPK(tx, 7, timestamp);
View Full Code Here


            tx.lock(master_2, Transaction.WRITE);
            tx.lock(master_3, Transaction.WRITE);
            tx.lock(master_4, Transaction.WRITE);
            tx.commit();

            tx.begin();
            OQLQuery query = odmg.newOQLQuery();
            query.create("select masters from " + Master.class.getName() + " where masterText like $1");
            query.bind("%" + timestamp);
            DList allMasters = (DList) query.execute();
View Full Code Here

        obj2.setContractValue2(2);
        try
        {
            // 1. Insert object
            Transaction tx = odmg.newTransaction();
            tx.begin();
            /*
            arminw:
            seems to have problems when within a tx a object
            was stored/deleted.
            Without obj1 test pass
View Full Code Here

            {
                fail("Wrong contract found");
            }

            // 2. Delete, then insert object with the same identity
            tx.begin();
            database.deletePersistent(obj2);
            database.makePersistent(obj1);
            tx.commit();
            result = getContract(contractPk, odmg);
            assertEquals("We should found exact one contract", 1, result.size());
View Full Code Here

            {
                fail("Wrong contract found");
            }

            // 3. Delete
            tx.begin();
            database.deletePersistent(obj1);
            tx.commit();

            result = getContract(contractPk, odmg);
            if (result.size() > 0)
View Full Code Here

        Transaction tx = odmg.newTransaction();

        //perform transaction
        try
        {
            tx.begin();

            Article example = new Article();
            example.setArticleId(777);
            example.setProductGroupId(7);
            db.makePersistent(example);
View Full Code Here

        Transaction tx = odmg.newTransaction();

        //perform transaction
        try
        {
            tx.begin();

            OQLQuery query = odmg.newOQLQuery();
            query.create("select anArticle from " + Article.class.getName() + " where articleId = 60");
            List results = (List) query.execute();
View Full Code Here

            fail("ODMGException: " + ex.getMessage());
        }
        Transaction tx = odmg.newTransaction();

        // perform transaction
        tx.begin();

        OQLQuery query = odmg.newOQLQuery();
        // use 'like' instead of '=' when perform query with wildcards
        query.create(
                "select anArticle from " + Article.class.getName() + " where productGroup.groupName like \"Fruit*\"");
 
View Full Code Here

        Transaction tx = odmg.newTransaction();

        //perform transaction
        try
        {
            tx.begin();

            OQLQuery query = odmg.newOQLQuery();
            query.create("select x from " + Article.class.getName() + " where productGroupId = 7");
            DList results = (DList) query.execute();
View Full Code Here

            db.bind(results, name);
            tx.commit();

            tx = odmg.newTransaction();
            tx.begin();

            ((TransactionImpl) tx).getBroker().clearCache();

            // look it up again
            DList newResults = (DList) db.lookup(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.