Package org.apache.ojb.otm.core

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


            article2.setStock(434);
            pg.setName("2");
            tx.commit();

            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidateAll();
            article = (Article) _conn.getObjectByIdentity(aOid);
            article2 = (Article) _conn.getObjectByIdentity(aOid2);
            assertEquals("should be equal", "2", article.getProductGroup().getName());
            assertEquals("should be equal", 433, article.getStock());
View Full Code Here


            assertEquals("should be equal", 434, article2.getStock());
            tx.commit();

            // Test M:N relations
            tx = _kit.getTransaction(_conn);
            tx.begin();
            person = (org.apache.ojb.broker.Person) _conn.getObjectByIdentity(prsOid);
            project = (org.apache.ojb.broker.Project) _conn.getObjectByIdentity(prjOid);
            person.getProjects().add(project);
            tx.commit();
View Full Code Here

            project = (org.apache.ojb.broker.Project) _conn.getObjectByIdentity(prjOid);
            person.getProjects().add(project);
            tx.commit();

            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidateAll();
            person = (org.apache.ojb.broker.Person) _conn.getObjectByIdentity(prsOid);
            project = (org.apache.ojb.broker.Project) _conn.getObjectByIdentity(prjOid);
            assertEquals("should be equal", 1, person.getProjects().size());
            tx.commit();
View Full Code Here

            try
            {
                if (tx == null || !tx.isInProgress())
                {
                    tx = _kit.getTransaction(_conn);
                    tx.begin();
                }

                if (aOid != null)
                {
                    article = (Article) _conn.getObjectByIdentity(aOid);
View Full Code Here

        Article article2;

        try
        {
            tx = _kit.getTransaction(_conn);
            tx.begin();

            pg = new ProductGroup();
            pg.setId(77777);
            _conn.makePersistent(pg);
            article = Article.createInstance();
View Full Code Here

            throws Exception
    {
        Transaction tx2 = null;

        tx2 = _kit.getTransaction(conn2);
        tx2.begin();
        try {
            conn2.getObjectByIdentity(oid, LockType.WRITE_LOCK);
            fail("LockingException was not thrown");
        } catch (LockingException ex) {
            // ok: we cannot write lock from another tx
View Full Code Here

        clearTestData();
        TestClassA a = generateTestData();
    TestClassB b = a.getB();
        Transaction tx = _kit.getTransaction(_conn);

        tx.begin();
        _conn.makePersistent(b);
        _conn.makePersistent(a);
        b.setA(a);
        tx.commit();
        /**
 
View Full Code Here

        /**
        * clear to start test
        */
        _conn.invalidateAll();
        tx = _kit.getTransaction(_conn);
        tx.begin();
        /**
     * load B
     */
    Identity oidb = _conn.getIdentity(b);
        TestClassB b1 = (TestClassB) _conn.getObjectByIdentity(oidb);
View Full Code Here

        Identity oid;
        Address address = new Address("oldCountry", "oldCity", "oldStreet");

        try {
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.makePersistent(address);
            oid = _conn.getIdentity(address);
            tx.commit();

            address.setStreet("newStreet");
View Full Code Here

            tx.commit();

            address.setStreet("newStreet");

            tx = _kit.getTransaction(_conn);
            tx.begin();
            address = (Address) _conn.getObjectByIdentity(oid);
            assertEquals("Cache was damaged.", "oldStreet", address.getStreet());
            tx.commit();

            address.setStreet("newStreet");
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.