Package org.apache.ojb.broker

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


        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        try
        {
            broker.beginTransaction();
            broker.store(obj);
            broker.commitTransaction();

            Identity oid = new Identity(obj, broker);
            obj = (TestObjectDefaultCache) broker.serviceObjectCache().lookup(oid);
            assertNotNull(obj);
View Full Code Here


        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        try
        {
            broker.beginTransaction();
            broker.store(obj);
            broker.commitTransaction();

            Identity oid = new Identity(obj, broker);
            obj = (TestObjectDefaultCache) broker.serviceObjectCache().lookup(oid);
            assertNotNull(obj);
            assertEquals(name, obj.getName());
View Full Code Here

        try
        {
            broker.beginTransaction();
            broker.store(obj);
            broker.store(dummy);
            broker.commitTransaction();

            Identity obj_oid = new Identity(obj, broker);
            Identity dummy_oid = new Identity(dummy, broker);
            ObjectCache cache = broker.serviceObjectCache();
            Object ret_obj = cache.lookup(obj_oid);
View Full Code Here


        broker1.commitTransaction();
        broker1.close();

        broker2.commitTransaction();
        broker2.close();
    }


View Full Code Here

    assertNull(id.getObjectsRealClass());
    Object group0 = pb0.getObjectByIdentity(id);
    assertNotNull(group0);
    assertEquals(CloneableGroup.class, id.getObjectsRealClass());
    assertStmtCount("access one group", 1);
    pb0.commitTransaction();

    resetStmtCount();
    pb1.beginTransaction();
    Object group1 = pb1.getObjectByIdentity(id);
    assertStmtCount("access one group again", 0); // lookup again, 2nd level hit, no SQL access.
View Full Code Here

        // Check whether the database was opened correctly
        try {
            PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker(connKey);
            broker.beginTransaction();
            Connection con = broker.serviceConnectionManager().getConnection();
            broker.commitTransaction();
            broker.close();
        } catch (Exception ex) {
            /*
             Finding the real reason for the error needs a bit of guesswork: first
             lets find the original exception
View Full Code Here

        } catch (DynaSqlException ex) {
            ex.printStackTrace();
        } catch ( LookupException ex ) {
            ex.printStackTrace();
        }
        broker.commitTransaction();
        broker.close();
       
        if ( oldVersion < 4 ) {
            // In older version hashcolumn was not included in schema so we must fill it.
            createHashes();
View Full Code Here

        {
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();

            broker.beginTransaction();
            broker.store(product);
            broker.commitTransaction();
        }
        catch (PersistenceBrokerException ex)
        {
            if (broker != null)
            {
View Full Code Here

            broker.beginTransaction();
            for (int idx = 0; idx < products.length; idx++)
            {
                broker.store(products[idx]);
            }
            broker.commitTransaction();
        }
        catch (PersistenceBrokerException ex)
        {
            if (broker != null)
            {
View Full Code Here

                broker.store(result);
                // alternative, more performant:
                // broker.store(result, ObjectModificationDefaultImpl.UPDATE);

                broker.commitTransaction();
                isSold = true;
            }
        }
        catch (PersistenceBrokerException ex)
        {
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.