Package org.apache.openjpa.kernel

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


        Object oida = broker.getObjectId(pta);
        long idb = ((Id) broker.getObjectId(ptb)).getId();
        broker.close();

        broker = getBrokerFactory().newBroker();
        broker.begin();
        sql.clear();
        pta = (PlaceholderTypesA) broker.find(oida, true, null);
        assertEquals(1, pta.getIntA());
        if (_union)
            assertEquals(1, sql.size());
View Full Code Here


        else
            assertNotSQL("UNION");
        broker.close();

        broker = getBrokerFactory().newBroker();
        broker.begin();
        sql.clear();
        ptb = (PlaceholderTypesB) broker.find(broker.newObjectId
            (PlaceholderTypesB.class, new Long(idb)), true, null);
        assertEquals(2, ptb.getIntA());
        assertEquals(3, ptb.getIntB());
View Full Code Here

   
    protected Object persist(Object ob) {
        //FIXME  - this is just a workaround
        //  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

    public void complexQuery(int size, Object ob, String filter, Class c) {

//        PersistenceManager pm = getPM();
        Broker broker = getBrokerFactory().newBroker();
        broker.setIgnoreChanges(false);
        broker.begin();

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

        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 =
            "SELECT o FROM " + c.getSimpleName() + " o WHERE o." + filter;
View Full Code Here

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

        broker = getBrokerFactory().newBroker();
        broker.begin();
        // test again against a new PM, for good measure
        assertSize(size,
            (List) broker.newQuery(JPQLParser.LANG_JPQL, c, qstrng).execute());
        broker.rollback();
View Full Code Here

        }
    }

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

        propsMap.put("openjpa.RemoteCommitProvider", "sjvm");
        EntityManagerFactory emf = getEmf(propsMap);
        BrokerFactory factory = JPAFacadeHelper.toBrokerFactory(emf);

        Broker broker = factory.newBroker();
        broker.begin();
        broker.persist(new CacheObjectAChild1("foo", "foo", 0), null);
        broker.persist(new CacheObjectAChild1("bar", "bar", 1), null);
        broker.commit();
        broker.close();
View Full Code Here

        ptb.setStringB("stringB");
        ptb.setClobB("clobB");
        ptb.setBlobB("blobB");

        Broker broker = getBrokerFactory().newBroker();
        broker.begin();
        broker.persist(pta, null);
        broker.persist(ptb, null);
        broker.commit();
        Object oida = broker.getObjectId(pta);
        long idb = ((Id) broker.getObjectId(ptb)).getId();
View Full Code Here

        Object oida = broker.getObjectId(pta);
        long idb = ((Id) broker.getObjectId(ptb)).getId();
        broker.close();

        broker = getBrokerFactory().newBroker();
        broker.begin();
        sql.clear();
        pta = (PlaceholderTypesA) broker.find(oida, true, null);
        assertEquals(1, pta.getIntA());
        if (_union)
            assertEquals(1, sql.size());
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.