Package org.apache.openjpa.persistence.kernel.common.apps

Examples of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1


            TrackingSavepointManager.class.getName() + "(AllowFlush=true)");
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        startTx(pm);
        pm.persist(new RuntimeTest1());
        pm.flush();
        try {
            pm.setSavepoint("a");
        } catch (Exception e) {
            fail("allows flush.");
View Full Code Here


  public void setUp()
  {
    deleteAll (RuntimeTest1.class);
    EntityManager pm = currentEntityManager();
    pm.getTransaction ().begin ();
    pm.persist(new RuntimeTest1("foo", 3));
    endTx(pm);
    endEm(pm);
  }
View Full Code Here

        Collection results = query.getResultList();
        return results;
    }

    private void persist(RuntimeTest1 parent, OpenJPAEntityManager pm) {
        RuntimeTest1 child;
        for (int i = 0; i < CHILD_COUNT; i++) {
            child = newRuntimeTest1("CHILD" + i, i * 10);
            child.setSelfOneOne(parent);
            parent.getSelfOneMany().add(child);
        }

        startTx(pm);
        pm.persist(parent);
View Full Code Here

        pm.persist(parent);
        endTx(pm);
    }

    private RuntimeTest1 newRuntimeTest1(String stringField, int intField) {
        RuntimeTest1 pc = new RuntimeTest1(stringField, intField);
        pc.setIntField(id++);
        return pc;
    }
View Full Code Here

        // deletes, and udpates

        // create objects
        RuntimeTest1[] persistables = new RuntimeTest1[numObjects];
        for (int i = 0; i < persistables.length; i++) {
            persistables[i] = new RuntimeTest1("foo #" + i, runningId + i);
        }
        runningId += persistables.length;

        // add them
        for (int i = 0; i < persistables.length; i++) {
View Full Code Here

    public void setUp() throws Exception {
        deleteAll(RuntimeTest1.class);

        OpenJPAEntityManager em = getPM();
        startTx(em);
        em.persist(new RuntimeTest1("ntw0", 0));
        em.persist(new RuntimeTest1("ntw1", 1));
        em.persist(new RuntimeTest1("ntw2", 2));
        em.persist(new RuntimeTest1("ntw3", 3));
        em.persist(new RuntimeTest1("ntw4", 4));
        endTx(em);
        endEm(em);

        em = getPM();
        startTx(em);
View Full Code Here

            "SELECT o FROM RuntimeTest1 o ORDER BY o.stringField ASC");
        q.setSubclasses(false);
        Collection c = (Collection) q.getResultList();

        Iterator iter = c.iterator();
        RuntimeTest1 o;
        while (iter.hasNext()) {
            o = (RuntimeTest1) iter.next();
            o.setStringField(o.getStringField() + " modified");
        }

        startTx(em);
        endTx(em);
View Full Code Here

        deleteAll(RuntimeTest1.class);

        OpenJPAEntityManager pm2 = getPM();
        startTx(pm2);
        name = "testMultiThreaded" + Math.random();
        RuntimeTest1 a = new RuntimeTest1(name,
            (int) (Math.random() * Integer.MAX_VALUE));
        pm2.persist(a);
        id = pm2.getObjectId(a);
        endTx(pm2);

View Full Code Here

        assertTrue("Transaction should have been active",
            pm.getTransaction().isActive());

        for (int i = 0; i < 3; i++) {
            pm.persist(new RuntimeTest1("testIterateExtent" + Math.random(),
                (int) (Math.random() * Integer.MAX_VALUE)));
        }

        assertTrue("Transaction should have been active",
            pm.getTransaction().isActive());
View Full Code Here

        props.put("openjpa.SavepointManager",
            TrackingSavepointManager.class.getName() + "(AllowFlush=false)");
        OpenJPAEntityManagerFactory pmf = getEmf(props);
        OpenJPAEntityManager pm = pmf.createEntityManager();
        startTx(pm);
        pm.persist(new RuntimeTest1());
        pm.setSavepoint("a");
        try {
            pm.flush();
            fail("should have failed.");
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1

Copyright © 2018 www.massapicom. 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.