Package org.apache.ojb.broker

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


    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

        int result = ((List) query.execute()).size();
        tx2.commit();
        assertEquals("Wrong number of objects wrote to DB", loops, result);

        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        broker.clearCache();
        Criteria crit = new Criteria();
        crit.addLike("articleName", PRE + "testLockLoop");
        result = broker.getCount(QueryFactory.newQuery(Article.class, crit));
        broker.close();
        assertEquals("Wrong number of objects wrote to DB", loops, result);
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(Project.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(Project.class);
        odmgZoosAfterOQL = getDBObjectCountViaOqlQueryUseNewTransaction(odmg, ODMGZoo.class);
View Full Code Here

        int result = ((List) query.execute()).size();
        tx2.commit();
        assertEquals("Wrong number of objects wrote to DB", loops, result);

        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        broker.clearCache();
        Criteria crit = new Criteria();
        crit.addLike("articleName", PRE + "testLockLoop");
        result = broker.getCount(QueryFactory.newQuery(Article.class, crit));
        broker.close();
        assertEquals("Wrong number of objects wrote to DB", loops, result);
View Full Code Here

     */
    protected void readArticlesByCursor() throws Exception
    {
        // clear the cache
        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        broker.clearCache();
        broker.close();

        Implementation odmg = OJB.getInstance();
        Database db = odmg.newDatabase();
        db.open(databaseName, Database.OPEN_READ_WRITE);
View Full Code Here

                insertNewArticles();
                // update all objects
                updateExistingArticles();
                // querying with empty cache
                PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
                broker.clearCache();
                broker.close();

                readArticles();
                // querying with hot cache
                readArticles();
View Full Code Here

        Gatherer fetchedGatherer = null;
        PersistenceBroker pb = null;
        try
        {
            pb = PersistenceBrokerFactory.defaultPersistenceBroker();
            pb.clearCache();
            Criteria crit = new Criteria();
            crit.addLike("name", name);
            Query q = QueryFactory.newQuery(Gatherer.class, crit);
            fetchedGatherer = (Gatherer) pb.getObjectByQuery(q);
        }
View Full Code Here

        fetchedGatherer = null;
        pb = null;
        try
        {
            pb = PersistenceBrokerFactory.defaultPersistenceBroker();
            pb.clearCache();
            Criteria crit = new Criteria();
            crit.addLike("name", name);
            Query q = QueryFactory.newQuery(Gatherer.class, crit);
            fetchedGatherer = (Gatherer) pb.getObjectByQuery(q);
        }
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.