Package org.odmg

Examples of org.odmg.Transaction.commit()


                it2 = aMaster.collDetailFKnoPK.iterator();
                while (it2.hasNext())
                    database.deletePersistent(it2.next());
                database.deletePersistent(aMaster);
            }
            tx.commit();
            assertEquals("Wrong count of Master objects found", 4, counter);

            query = odmg.newOQLQuery();
            query.create("select masters from " + Master.class.getName() + " where masterText like $1");
            query.bind("%" + timestamp);
View Full Code Here


            existing instance as dirty a second time.
            So it's no wonder why after deletePersistent(obj1); no contract is found.
            Works as designed.
            The Lesson to learn: never let business objects have the same primary key values!
             * */
            tx.commit();
            Collection result = getContract(contractPk, odmg);
            assertEquals("We should found exact one contract", 1, result.size());
            obj2 = (Contract) result.iterator().next();
            if (obj2 == null)
            {
View Full Code Here

            // 2. Delete, then insert object with the same identity
            tx.begin();
            database.deletePersistent(obj2);
            database.makePersistent(obj1);
            tx.commit();
            result = getContract(contractPk, odmg);
            assertEquals("We should found exact one contract", 1, result.size());
            obj1 = (Contract) result.iterator().next();
            if (obj1 == null)
            {
View Full Code Here

            }

            // 3. Delete
            tx.begin();
            database.deletePersistent(obj1);
            tx.commit();

            result = getContract(contractPk, odmg);
            if (result.size() > 0)
            {
                fail("Contract was not deleted");
View Full Code Here

            example.addToStock(47);
            example.addToStock(7);
            example.addToStock(4);

            //System.out.println("now commit all changes...");
            tx.commit();
        }
        catch (Exception ex)
        {
            tx.abort();
        }
View Full Code Here

            Article b = (Article) broker.getObjectByIdentity(oid);

            assertEquals("should be same object", a, b);

            //System.out.println("now commit all changes...");
            tx.commit();
        }
        catch (Exception ex)
        {
            tx.abort();
            fail("ODMGException: " + ex.getMessage());
View Full Code Here

        ProductGroup pg = (ProductGroup) check.get(0);

        assertEquals(pg.getAllArticlesInGroup().size(), results.size());
        assertTrue((results.size() > 0));

        tx.commit();


        // close database

        db.close();
View Full Code Here

//            OJB.getLogger().debug(results);

            String name = "gimme fruits_" + System.currentTimeMillis();

            db.bind(results, name);
            tx.commit();

            tx = odmg.newTransaction();
            tx.begin();

            ((TransactionImpl) tx).getBroker().clearCache();
View Full Code Here

            assertEquals(originalSize, newResults.size());
            Article art = (Article) newResults.get(0);
            assertNotNull(art);
//            OJB.getLogger().info(results);

            tx.commit();

        }
        catch (Exception e)

        {
View Full Code Here

            Article b = (Article) broker.getObjectByIdentity(oid);

            assertEquals("should be same object", a, b);

            //System.out.println("now commit all changes...");
            tx.commit();
        }
        catch (Exception ex)

        {
            tx.abort();
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.