Package org.apache.ojb.otm.core

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


        try
        {
            conn = kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
            tx   = kit.getTransaction(conn);

            tx.begin();

            conn.makePersistent(product);

            tx.commit();
        }
View Full Code Here


        try
        {
            conn = kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
            tx   = kit.getTransaction(conn);

            tx.begin();

            conn.deletePersistent(product);

            tx.commit();
        }
View Full Code Here

        try
        {
            conn = kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
            tx   = kit.getTransaction(conn);

            tx.begin();

            Iterator results = conn.getIteratorByQuery(query);

            tx.commit();
View Full Code Here

        try
        {
            conn = kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
            tx   = kit.getTransaction(conn);

            tx.begin();

            Iterator results = conn.getIteratorByQuery(query, lock);

            tx.commit();
View Full Code Here

                {
                    oql.bind(queryParams[idx]);
                }
            }

            tx.begin();

            Iterator results = conn.getIteratorByOQLQuery(oql);

            tx.commit();
View Full Code Here

            boolean auto = !tx.isInProgress();

            if (auto)
            {
                tx.begin();
            }

            Iterator results = conn.getIteratorByQuery(query, lock);

            if (auto)
View Full Code Here

        try
        {
            conn = kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
            tx   = kit.getTransaction(conn);

            tx.begin();

            Product sample = new Product();

            sample.setName("Wonder Widget");
View Full Code Here

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

            example = (Article) _conn.getObjectByIdentity(
                    new Identity(Article.class, Article.class,
                                 new Object[] {new Integer(77777)}));
            if (example == null)
View Full Code Here

            Identity oid = _conn.getIdentity(example);

            // get from the cache
            tx = _kit.getTransaction(_conn);
            tx.begin();
            example = (Article) _conn.getObjectByIdentity(oid);
            assertEquals("should be equal", 7, example.getProductGroupId());
            assertEquals("should be equal", 333, example.getStock());
            assertEquals("should be equal", "333", example.getArticleName());
            tx.commit();
View Full Code Here

            assertEquals("should be equal", "333", example.getArticleName());
            tx.commit();

            // get from the database
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidate(oid);
            example = (Article) _conn.getObjectByIdentity(oid);
            assertEquals("should be equal", 7, example.getProductGroupId());
            assertEquals("should be equal", "333", example.getArticleName());
            example.setArticleName("334"); // test update
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.