Package org.apache.ojb.otm.core

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


            tx.commit();

            // get from the database via Query
            tx = _kit.getTransaction(_conn);
            _conn.invalidate(oid);
            tx.begin();
            crit = new Criteria();
            crit.addEqualTo("articleId", new Integer(77777));
            crit.addEqualTo("articleName", "334");
            q = QueryFactory.newQuery(Article.class, crit);
            it = _conn.getIteratorByQuery(q);
View Full Code Here


            tx.commit();

            // get from the database via OQLQuery Iterator
            tx = _kit.getTransaction(_conn);
            _conn.invalidate(oid);
            tx.begin();
            oql = _conn.newOQLQuery();
            oql.create("select a from " + Article.class.getName()
                + " where articleId=$1 and articleName=$2");
            oql.bind(new Integer(77777));
            oql.bind("335");
View Full Code Here

            tx.commit();

            // get from the database via OQLQuery Collection
            tx = _kit.getTransaction(_conn);
            _conn.invalidate(oid);
            tx.begin();
            oql.bind(new Integer(77777));
            oql.bind("336");
            it = ((Collection) oql.execute()).iterator();
            if (it.hasNext())
            {
View Full Code Here

            }
            tx.commit();

            // get from the database
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidate(oid);
            example = (Article) _conn.getObjectByIdentity(oid);
            assertEquals("should be equal", "337", example.getArticleName());
            tx.commit();
View Full Code Here

            tx.commit();

            try
            {
                tx = _kit.getTransaction(_conn);
                tx.begin();
                example = (Article) _conn.getObjectByIdentity(oid);
                _conn.deletePersistent(example);
                tx.commit();
            }
            catch (Throwable ex)
View Full Code Here

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

            ProductGroupWithCollectionProxy pg = new ProductGroupWithCollectionProxy();
            pg.setId(77777);
            pg.setName("1");
            _conn.makePersistent(pg);
View Full Code Here

            Identity oid = _conn.getIdentity(pg);

            // get from the database
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidate(oid);
            pg = (ProductGroupWithCollectionProxy) _conn.getObjectByIdentity(oid);
            assertTrue("CollectionProxy isn't loaded",
                    !((CollectionProxyDefaultImpl) pg.getAllArticlesInGroup()).isLoaded());
            Article article = Article.createInstance();
View Full Code Here

            _conn.makePersistent(article);
            tx.commit();

            // get from the database
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidate(oid);
            pg = (ProductGroupWithCollectionProxy) _conn.getObjectByIdentity(oid);
            assertEquals("CollectionProxy size", 1, pg.getAllArticlesInGroup().size());
            ((InterfaceArticle) pg.getAllArticlesInGroup().get(0)).setArticleName("444");
            tx.commit();
View Full Code Here

            // test isolation of the cache
            ((InterfaceArticle) pg.getAllArticlesInGroup().get(0)).setArticleName("555");

            tx = _kit.getTransaction(_conn);
            tx.begin();
            pg = (ProductGroupWithCollectionProxy) _conn.getObjectByIdentity(oid);
            assertEquals("Article name", "444",
                    ((InterfaceArticle) pg.getAllArticlesInGroup().get(0)).getArticleName());
            tx.commit();
View Full Code Here

            tx.commit();

            try
            {
                tx = _kit.getTransaction(_conn);
                tx.begin();
                pg = (ProductGroupWithCollectionProxy) _conn.getObjectByIdentity(oid);
                _conn.deletePersistent(pg.getAllArticlesInGroup().get(0));
                _conn.deletePersistent(pg);
                tx.commit();
            }
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.