Package org.apache.ojb.otm.core

Examples of org.apache.ojb.otm.core.Transaction.begin()


        /**
        * now get A again and make sure the related B is updated to reflect
        * the new value.
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        TestClassA a2 = (TestClassA) _conn.getObjectByIdentity(oid);
        assertTrue(a2.getB() != null);
        assertTrue(a2.getB().getValue1().equals("goodbye there"));
        tx.commit();
        clearTestData();
View Full Code Here


    {
        clearTestData();
        TestClassA a = generateTestData();
        TestClassB b2 = generateAnotherB();
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        _conn.makePersistent(a.getB());
        _conn.makePersistent(a);
        tx.commit();
        /**
         * change B
View Full Code Here

        tx.commit();
        /**
         * change B
         */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        Identity oid = _conn.getIdentity(a);
        TestClassA a1 = (TestClassA) _conn.getObjectByIdentity(oid);
        _conn.makePersistent(b2);
        a1.setB(b2);
        tx.commit();
View Full Code Here

        _conn.makePersistent(b2);
        a1.setB(b2);
        tx.commit();

        tx = _kit.getTransaction(_conn);
        tx.begin();
        a = (TestClassA) _conn.getObjectByIdentity(oid);
        assertTrue(a.getB() != null);
        assertTrue(a.getB().getValue1().equals("value2"));
        a.setB(null);
        tx.commit();
View Full Code Here

        assertTrue(a.getB().getValue1().equals("value2"));
        a.setB(null);
        tx.commit();

        tx = _kit.getTransaction(_conn);
        tx.begin();
        a = (TestClassA) _conn.getObjectByIdentity(oid);
        assertTrue(a.getB() == null);
        tx.commit();
    }
View Full Code Here

    public void testSwizzle1toN() throws Exception
    {
        clearTestData();
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        ProductGroup pg = new ProductGroup();
        pg.setId(77777);
        pg.setName("1");
        _conn.makePersistent(pg);
        Article article = Article.createInstance();
View Full Code Here

        _conn.makePersistent(article);
        Identity pgOid = _conn.getIdentity(pg);
        tx.commit();

        tx = _kit.getTransaction(_conn);
        tx.begin();
        pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
        pg.getAllArticlesInGroup().clear();
        tx.commit();

        tx = _kit.getTransaction(_conn);
View Full Code Here

        pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
        pg.getAllArticlesInGroup().clear();
        tx.commit();

        tx = _kit.getTransaction(_conn);
        tx.begin();
        pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
        assertEquals("should be equal", 0, pg.getAllArticlesInGroup().size());
        tx.commit();

        tx = _kit.getTransaction(_conn);
View Full Code Here

        pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
        assertEquals("should be equal", 0, pg.getAllArticlesInGroup().size());
        tx.commit();

        tx = _kit.getTransaction(_conn);
        tx.begin();
        pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
        pg.getAllArticlesInGroup().add(article);
        tx.commit();

        tx = _kit.getTransaction(_conn);
View Full Code Here

        pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
        pg.getAllArticlesInGroup().add(article);
        tx.commit();

        tx = _kit.getTransaction(_conn);
        tx.begin();
        pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
        assertEquals("should be equal", 1, pg.getAllArticlesInGroup().size());
        tx.commit();
        clearTestData();
    }
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.