Package org.apache.ojb.broker

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


      Connection con = pb.serviceConnectionManager().getConnection();
      Integer previousIsolationLevel = DataSourceUtils.prepareConnectionForTransaction(con, definition);
      txObject.setPreviousIsolationLevel(previousIsolationLevel);

      pb.beginTransaction();

      // Register the OJB PersistenceBroker's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        ConnectionHolder conHolder = new ConnectionHolder(con);
        if (definition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) {
View Full Code Here


    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.isReadOnly();
    conControl.setReturnValue(false, 1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.commitTransaction();
    pbControl.setVoidCallable(1);
View Full Code Here

    conControl.setReturnValue(true, 1);
    con.setReadOnly(false);
    conControl.setVoidCallable(1);
    con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    conControl.setVoidCallable(1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.abortTransaction();
    pbControl.setVoidCallable(1);
View Full Code Here

    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.isReadOnly();
    conControl.setReturnValue(false, 1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.commitTransaction();
    pbControl.setVoidCallable(1);
View Full Code Here

    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.isReadOnly();
    conControl.setReturnValue(false, 1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.abortTransaction();
    pbControl.setVoidCallable(1);
View Full Code Here

    conControl.setReturnValue(false, 2);
    pb1.beginTransaction();
    pb1Control.setVoidCallable(1);
    pb2.serviceConnectionManager();
    pb2Control.setReturnValue(cm, 2);
    pb2.beginTransaction();
    pb2Control.setVoidCallable(1);
    pb2.commitTransaction();
    pb2Control.setVoidCallable(1);
    pb2.close();
    pb2Control.setReturnValue(true, 1);
View Full Code Here

    pbControl.setReturnValue(cm, 2);
    cm.getConnection();
    cmControl.setReturnValue(con, 2);
    con.isReadOnly();
    conControl.setReturnValue(false, 1);
    pb.beginTransaction();
    pbControl.setVoidCallable(1);
    pb.delete(entity);
    pbControl.setVoidCallable(1);
    pb.commitTransaction();
    pbControl.setVoidCallable(1);
View Full Code Here

        try
        {
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();

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

        try
        {
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();

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

            QueryByCriteria query  = new QueryByCriteria(template);
            Product         result = (Product)broker.getObjectByQuery(query);

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

                broker.store(result);
                // alternative, more performant:
                // broker.store(result, ObjectModificationDefaultImpl.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.