Package org.apache.ojb.odmg

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


    public static void persistChanges(Product product)
    {
        Implementation impl = OJB.getInstance();
        TransactionExt tx  = (TransactionExt)impl.newTransaction();

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

    /**
 
View Full Code Here


        TransactionExt tx = (TransactionExt) odmg.newTransaction();
        // we don't want implicite locks when compare performance
        tx.setImplicitLocking(false);
        String sql = "select allArticles from " + PerformanceArticle.class.getName() + " where articleId=$1";
        long start = System.currentTimeMillis();
        tx.begin();
        for(int i = 0; i < articleCount; i++)
        {
            OQLQuery query = odmg.newOQLQuery();
            query.create(sql);
            query.bind(arr[i].getArticleId());
View Full Code Here

    protected void readArticlesByCursor() throws Exception
    {
        TransactionExt tx = (TransactionExt) odmg.newTransaction();
        // we don't want implicite locks when compare performance
        tx.setImplicitLocking(false);
        tx.begin();
        // clear cache to read from DB
        tx.getBroker().clearCache();

        long start = System.currentTimeMillis();
        OQLQuery query = odmg.newOQLQuery();
View Full Code Here

        Implementation odmg = OJB.getInstance();
        Database db = odmg.newDatabase();
        db.open(TestHelper.DEF_DATABASE_NAME, Database.OPEN_READ_WRITE);

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

        tx.begin();
View Full Code Here

        tx.begin();
        db.makePersistent(s_ref_4);
        db.makePersistent(obj_2);
        tx.commit();

        tx.begin();

        // try to find object
        Criteria crit = new Criteria();
        crit.addEqualTo("name", name);
        QueryByCriteria query = QueryFactory.newQuery(MainObject.class, crit);
View Full Code Here

        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);
        obj_2.addReference(ref_6);
        tx.commit();

        references = obj_2.getAllReferences();
View Full Code Here

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

        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();
View Full Code Here

        assertEquals("Reference expected for object", 1, references.size());

        assertEquals(id_2, obj_2.getIdentifier());

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

        broker = PersistenceBrokerFactory.defaultPersistenceBroker();
View Full Code Here

        obj_2 = (MainObject) broker.getObjectByIdentity(oid_2);
        broker.close();

        // now update reference
        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");
View Full Code Here

    public static void persistChanges(Product product)
    {
        Implementation impl = OJB.getInstance();
        TransactionExt tx  = (TransactionExt)impl.newTransaction();

        tx.begin();
        tx.markDirty(product);
        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.