Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.PersistenceBroker.clearCache()


            Article example = new Article();
            example.setArticleId(60);
            Identity oid = new Identity(example, ((TransactionImpl) tx).getBroker());
            // 2. lookup object by OID
            PersistenceBroker broker = ((TransactionImpl) tx).getBroker();
            broker.clearCache();
            Article b = (Article) broker.getObjectByIdentity(oid);

            assertEquals("should be same object", a, b);

            //System.out.println("now commit all changes...");
View Full Code Here


            example.setArticleId(30);
            Identity oid = new Identity(example, ((TransactionImpl) tx).getBroker());

            // 2. lookup object by OID
            PersistenceBroker broker = ((TransactionImpl) tx).getBroker();
            broker.clearCache();
            Article b = (Article) broker.getObjectByIdentity(oid);

            assertEquals("should be same object", a, b);

            //System.out.println("now commit all changes...");
View Full Code Here

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

        broker = ((HasBroker) tx).getBroker();
        broker.clearCache();

        DMap mapA = (DMap) db.lookup(name);
        Article val1A = (Article) mapA.get(key1);
        assertEquals(val1.getArticleId(), val1A.getArticleId());
        Article val2A = (Article) mapA.get(key2);
View Full Code Here

            broker.beginTransaction();
            broker.store(compChild);
            broker.commitTransaction();

            Identity oid = new Identity(compChild, broker);
            broker.clearCache();
            compChild = (ObjectRepository.Component) broker.getObjectByIdentity(oid);

            assertNotNull(compChild);
            assertNotNull(compChild.getParentComponent());
View Full Code Here

        storeObjects(tx, getNewProjects("testResultsAfterTransactionWithClearedCache", 2));
        tx.commit();

        //###### hack we clear cache of PB ########
        PersistenceBroker tmp = PersistenceBrokerFactory.defaultPersistenceBroker();
        tmp.clearCache();
        tmp.close();

        int odmgZoosAfter = getDBObjectCountWithNewPB(ODMGZoo.class);
        int projectsAfter = getDBObjectCountWithNewPB(ODMGGourmet.class);
        int odmgZoosAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg, ODMGZoo.class);
View Full Code Here

        storeObjects(tx, getNewProjects("testResultsAfterTransactionWithClearedCache", 2));
        tx.commit();

        //###### hack we clear cache of PB ########
        tmp = PersistenceBrokerFactory.defaultPersistenceBroker();
        tmp.clearCache();
        tmp.close();

        odmgZoosAfter = getDBObjectCountWithNewPB(ODMGZoo.class);
        projectsAfter = getDBObjectCountWithNewPB(ODMGGourmet.class);
        odmgZoosAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg, ODMGZoo.class);
View Full Code Here

    pb0 = PersistenceBrokerFactory.defaultPersistenceBroker();
    pb1 = PersistenceBrokerFactory.defaultPersistenceBroker();
    assertNotSame(pb0, pb1);

    resetStmtCount();
    pb0.clearCache();
    pb0.beginTransaction();
    Identity id = new Identity(null, CloneableGroup.class, new Object[] {new Integer(1)});
    logger.info(id.toString());
    assertNull(id.getObjectsRealClass());
    Object group0 = pb0.getObjectByIdentity(id);
View Full Code Here

        }
        finally
        {
            if (pb != null)
            {
                pb.clearCache();
                pb.close();
            }
        }

        PersistenceBrokerFactory.releaseAllInstances();
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.