Package org.apache.ojb.odmg

Examples of org.apache.ojb.odmg.TransactionExt.commit()


        Implementation impl = OJB.getInstance();
        TransactionExt tx  = (TransactionExt)impl.newTransaction();

        tx.begin();
        tx.markDirty(product);
        tx.commit();
    }

    /**
     * The main entry point for this sample application.
     *
 
View Full Code Here


            OQLQuery query = odmg.newOQLQuery();
            query.create(sql);
            query.bind(arr[i].getArticleId());
            query.execute();
        }
        tx.commit();
        long stop = System.currentTimeMillis();
        logger.info("querying " + articleCount + " Objects: " + (stop - start) + " msec");
    }

    /**
 
View Full Code Here

        TransactionExt tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        db.makePersistent(s_ref_4);
        db.makePersistent(obj_2);
        tx.commit();

        tx.begin();

        // try to find object
        Criteria crit = new Criteria();
View Full Code Here

        MainObject retObj = (MainObject) tx.getBroker().getObjectByIdentity(oid_2);

        List refList = retObj.getAllReferences();
        assertNotNull(refList);
        assertEquals("object do not have references", 0, refList.size());
        tx.commit();

        // add new reference to object
        CollectionReference ref_6 = new CollectionReference(null, "###_new_" + nameRef);
        tx.begin();
        tx.lock(obj_2, Transaction.WRITE);
View Full Code Here

        // add new reference to object
        CollectionReference ref_6 = new CollectionReference(null, "###_new_" + nameRef);
        tx.begin();
        tx.lock(obj_2, Transaction.WRITE);
        obj_2.addReference(ref_6);
        tx.commit();

        references = obj_2.getAllReferences();
        assertNotNull(references);
        assertEquals("1 references expected for object: "+obj_2, 1, references.size());
View Full Code Here

        tx.begin();
        obj_2 = (MainObject) tx.getBroker().getObjectByIdentity(oid_2);
        // we don't change the main object, only add an reference, so the
        // cached version of the object isn't up to date
        tx.getBroker().retrieveAllReferences(obj_2);
        tx.commit();

        assertNotNull(obj_2);
        references = obj_2.getAllReferences();
        assertNotNull(references);
        assertEquals("Reference expected for object", 1, references.size());
View Full Code Here

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

        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        obj_2 = (MainObject) broker.getObjectByIdentity(oid_2);
        broker.close();
View Full Code Here

        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();

        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        obj_2 = (MainObject) broker.getObjectByIdentity(oid_2);
        assertNotNull(obj_2);
        references = obj_2.getAllReferences();
View Full Code Here

        Implementation impl = OJB.getInstance();
        TransactionExt tx  = (TransactionExt)impl.newTransaction();

        tx.begin();
        tx.markDirty(product);
        tx.commit();
    }

    /**
     * The main entry point for this sample application.
     *
 
View Full Code Here

        TransactionExt tx = (TransactionExt) odmg.newTransaction();
        tx.begin();
        db.makePersistent(s_ref_4);
        db.makePersistent(obj_2);
        tx.commit();

        tx.begin();

        // try to find object
        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.