Package org.apache.ojb.broker

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


  public void testStore() {
    MockControl pbControl = MockControl.createControl(PersistenceBroker.class);
    final PersistenceBroker pb = (PersistenceBroker) pbControl.getMock();
    Object entity = new Object();
    pb.store(entity);
    pbControl.setVoidCallable(1);
    pb.close();
    pbControl.setReturnValue(true, 1);
    pbControl.replay();
View Full Code Here


        try
        {
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();

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

            broker = PersistenceBrokerFactory.defaultPersistenceBroker();

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

            if (result != null)
            {
                broker.beginTransaction();
                result.setStock(result.getStock() - 1);

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

                broker.commitTransaction();
                isSold = true;
View Full Code Here

        try
        {
            logger.debug("OjbStoreManager.insert");
            PersistenceBroker broker = connector.getBroker();
            Object instance = sm.getObject();
            broker.store(instance, ObjectModificationDefaultImpl.INSERT);
        }
        catch (Exception ex)
        {
            throw new OjbStoreFatalInternalException(getClass(), "insert", ex);
        }
View Full Code Here

        {
          logger.debug("OjbStoreManager.update");
            PersistenceBroker broker = connector.getBroker();
            fetch(sm, null);
            Object instance = sm.getObject();
            broker.store(instance, ObjectModificationDefaultImpl.UPDATE);
        }
        catch (Exception ex)
        {
            throw new OjbStoreFatalInternalException(getClass(), "update", ex);
        }
View Full Code Here

            Iterator it = insertMap.values().iterator();
            while(it.hasNext())
            {
                NamedEntry namedEntry = (NamedEntry) it.next();
                namedEntry.prepareForStore(broker);
                broker.store(namedEntry, ObjectModification.INSERT);
            }
        }
    }

    public void afterWriteCleanup()
View Full Code Here

            // 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();
        }
        catch (OJBRuntimeException ex)
        {
View Full Code Here

      throw new IllegalArgumentException("The value object to be updated is null.");
    }

    PersistenceBroker broker = getPersistenceBroker();

    broker.store(vo);
  }

  /**
   * Removes an instance/value object from the persistence layer.
   *
 
View Full Code Here

      throw new IllegalArgumentException("The value object to be created is null.");
    }

    PersistenceBroker broker = getPersistenceBroker();

    broker.store(vo);
  }

  /**
   * Retrieves an instance/value object, according to its primary key,
   *
 
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.