Package org.apache.openjpa.kernel

Examples of org.apache.openjpa.kernel.Broker.commit()


    protected Object persist(Object ob) {
        Broker broker = getBrokerFactory().newBroker();
        broker.begin();
        broker.persist(ob, null);
        Object id = broker.getObjectId(ob);
        broker.commit();
        broker.close();
        return id;
    }

    protected Properties getProperties() {
View Full Code Here


        broker.begin();

        broker.persist(ob, null);
        // test in-memory
        // assertSize (size, pm.newQuery (c, filter));
        broker.commit();

        broker.begin();
        // test against database
//        OpenJPAQuery q = pm.createQuery("SELECT o FROM "+c.getSimpleName()+"o WHERE o."+filter);
        String qstrng =
View Full Code Here

        String qstrng =
            "SELECT o FROM " + c.getSimpleName() + " o WHERE o." + filter;
        assertSize(size,
            (List) broker.newQuery(JPQLParser.LANG_JPQL, c, qstrng).execute());

        broker.commit();
        broker.close();

        broker = getBrokerFactory().newBroker();
        broker.begin();
        // test again against a new PM, for good measure
View Full Code Here

       
        OpenJPAEntityManager em =(OpenJPAEntityManager)currentEntityManager();
        Broker broker = JPAFacadeHelper.toBroker(em);
        broker.begin();
        broker.persist(pc, null);
        broker.commit();
        _pc = broker.getObjectId(pc);
        _rel = broker.getObjectId(rel);
        broker.close();
        em.close();
    }
View Full Code Here

        //  Broker broker = .getBrokerFactory().newBroker();
        Broker broker = JPAFacadeHelper.toBroker(currentEntityManager());
        broker.begin();
        broker.persist(ob, null);
        Object id = broker.getObjectId(ob);
        broker.commit();
        broker.close();
        return id;
    }
   
View Full Code Here

        CacheObjectWithExternalizedFields o =
            new CacheObjectWithExternalizedFields();
        broker.persist(o, null);
        o.setCls(Broker.class);

        broker.commit();
        broker.close();

        CacheTestHelper.cacheManager(_factory).getSystemQueryCache().clear();
    }
View Full Code Here

        }

        broker.persist(new SelfReferencingCacheTestObject("foo",
            new SelfReferencingCacheTestObject("bar", null)), null);

        broker.commit();
        broker.close();

        CacheTestHelper.cacheManager(_factory).getSystemQueryCache().clear();
    }
View Full Code Here

        Broker broker = _factory.newBroker();
        broker.begin();
        for (int i = 0; i < 50; i++)
            broker.persist(new CacheObjectAChild1("", "JPQL2Queries", i),
                null);
        broker.commit();
        broker.close();

        CacheTestHelper.cacheManager(_factory).getSystemQueryCache().clear();
    }
View Full Code Here

        broker.begin();
        CacheObjectE e = new CacheObjectE("bar");
        CacheObjectJ j = new CacheObjectJ("foo", e);
        broker.persist(j, null);
        broker.persist(e, null);
        broker.commit();
        _eId = broker.getObjectId(e);
        broker.close();
    }

    public void testPCParameter() {
View Full Code Here

        c = (Collection) q.execute(new Object[]{ e });
        Object o2 = c.iterator().next();
        assertTrue(o2 instanceof CacheObjectJ);
        assertTrue(o == o2);

        broker.commit();
        broker.close();
    }
}
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.