Package org.apache.ojb.otm.core

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


            article.setArticleId(77777);
            article.setStock(373);
            pg.add(article);
            article.setProductGroup(pg);
            _conn.makePersistent(article);
            tx.commit();

            Identity aOid = _conn.getIdentity(article);
            Identity pgOid = _conn.getIdentity(pg);

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


            tx = _kit.getTransaction(_conn);
            tx.begin();
            article = (Article) _conn.getObjectByIdentity(aOid);
            assertEquals("should be equal", "1", article.getProductGroup().getName());
            tx.commit();

            // test checkpoint
            tx = _kit.getTransaction(_conn);
            tx.begin();
            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
View Full Code Here

            tx = _kit.getTransaction(_conn);
            tx.begin();
            article = (Article) _conn.getObjectByIdentity(aOid);
            assertEquals("should be equal", "1", article.getProductGroup().getName());
            tx.commit();

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

                tx = _kit.getTransaction(_conn);
                tx.begin();
                article = (Article) _conn.getObjectByIdentity(aOid);
                _conn.deletePersistent(article);
                _conn.deletePersistent(article.getProductGroup());
                tx.commit();
            }
            catch (Throwable ex)
            {
                ex.printStackTrace();
                tx.rollback();
View Full Code Here

            tx2 = _kit.getTransaction(conn2);
            tx2.begin();
            pg = (ProductGroup) conn2.getObjectByIdentity(pgOid);
            assertEquals("should be equal", "1", pg.getName());
            tx2.commit();
            tx.commit();

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

                public void run()
                {
                    try
                    {
                        Thread.sleep(1000);
                        tx3.commit();
                    }
                    catch (InterruptedException ex)
                    {
                    }
                }
View Full Code Here

            prsOid = _conn.getIdentity(person);
            project = new org.apache.ojb.broker.Project(77777, "title", "desc");
            prjOid = _conn.getIdentity(project);
            _conn.makePersistent(person);
            _conn.makePersistent(project);
            tx.commit();


            tx = _kit.getTransaction(_conn);
            tx.begin();
            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
View Full Code Here

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

            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidateAll();
            article = (Article) _conn.getObjectByIdentity(aOid);
View Full Code Here

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

            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();

            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidateAll();
            person = (org.apache.ojb.broker.Person) _conn.getObjectByIdentity(prsOid);
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.