Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.PersistenceBroker.beginTransaction()


        we need to commit used connection.
        */
        PersistenceBroker targetBroker = getBrokerForClass();
        if(!targetBroker.isInTransaction())
        {
            targetBroker.beginTransaction();
            needsCommit = true;
        }
        try
        {
            // lookup sequence name
View Full Code Here


            get the same sequence.
            Thus we use a new internBroker instance (with new connection) to
            avoid this problem.
            */
            internBroker = PersistenceBrokerFactory.createPersistenceBroker(brokerForSequence.getPBKey());
            internBroker.beginTransaction();

            newSequence = lookupStoreSequence(internBroker, field, sequenceName);

            internBroker.commitTransaction();

View Full Code Here

            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
            CldTestObject obj = new CldTestObject();
            obj.setName("testLoadingProfiles");
            try
            {
                broker.beginTransaction();
                broker.store(obj);
                broker.commitTransaction();
                try
                {
                    // try to find persistent object, only available in global
View Full Code Here

            ObjectRepository.Component compParent = new ObjectRepository.Component();
            compParent.setName("MetadataTest_parent");
            compChild.setParentComponent(compParent);

            broker.beginTransaction();
            broker.store(compChild);
            broker.commitTransaction();

            Identity oid = new Identity(compChild, broker);
            broker.clearCache();
View Full Code Here

            get the same sequence.
            Thus we use a new internBroker instance (with new connection) to
            avoid this problem.
            */
            internBroker = PersistenceBrokerFactory.createPersistenceBroker(brokerForSequence.getPBKey());
            internBroker.beginTransaction();

            newSequence = lookupStoreSequence(internBroker, field, sequenceName);

            internBroker.commitTransaction();

View Full Code Here

        try
        {
            // 2. create a broker and ask it to retrieve the Product collection
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
            // 3. start broker transaction
            broker.beginTransaction();
            // 4. retrieve the products
            result = broker.getCollectionByQuery(query);
            // 5. abort transaction (because we don't want to change anything)
            broker.abortTransaction();
        }
View Full Code Here

        try
        {
            // 3. get a broker and lookup the product specified by the QBE
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
            // 4. start broker transaction
            broker.beginTransaction();
            // 5. retrieve object
            result = (Product)broker.getObjectByQuery(query);
            // 6. abort transaction (because we don't want to change anything)
            broker.abortTransaction();
        }
View Full Code Here

        try
        {
            // 1. get a broker
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
            // 2. start broker transaction
            broker.beginTransaction();
            // 3. now ask broker to store the edited object
            broker.store(product);
            // 4. commit transaction
            broker.commitTransaction();
        }
View Full Code Here

        try
        {
            // 3. get a broker
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
            // 4. start broker transaction
            broker.beginTransaction();
            // 5. delete product
            broker.deleteByQuery(query);
            // 6. commit transaction
            broker.commitTransaction();
        }
View Full Code Here

    pb1 = PersistenceBrokerFactory.defaultPersistenceBroker();
    assertNotSame(pb0, pb1);

    resetStmtCount();
    pb0.clearCache();
    pb0.beginTransaction();
    Identity id = new Identity(null, CloneableGroup.class, new Object[] {new Integer(1)});
    logger.info(id.toString());
    assertNull(id.getObjectsRealClass());
    Object group0 = pb0.getObjectByIdentity(id);
    assertNotNull(group0);
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.