I never saw in the examples closing the broker.  I am not sure if this
method is a correct usage?

/*
*  Store an object to the database
* 
* @param theObject      The object to save   
* @param autoCommit   Whether to start a transaction and commit/rollback the
save in this call
*/

public void saveObject(Object theObject, boolean autoCommit) throws
RemoteException
{
      PersistenceBroker
broker=PersistenceBrokerFactory.defaultPersistenceBroker();
      try{
       try{

        if (autoCommit){broker.beginTransaction();}

        broker.store(theObject);

        if (autoCommit){broker.commitTransaction();}

       } catch (PersistenceBrokerException  ex)
       {
        if (autoCommit){broker.abortTransaction();}
        throw new RemoteException("Error persisting object "+theObject, ex);
       }
      } finally
      {
      broker.close();
      }
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to