Hello all

Does the Peer OM have any transaction support now? I searched the archive
and the last message about this was last May. I see that peers have update
methods which can be passed an external dbconnection.

I'm assuming it should be used like this:


    public static void doMyTransaction()
        throws Exception
    {
        DBConnection db = null;
        try
        {
            // get a connection to the db
            db = DBBroker.getInstance().getConnection();
            Connection connection = db.getConnection();

            // Turn autocommit off. I'm assuming the peer methods that allow
a connection to be passed
            // don't do this already.
                connection.setAutoCommit(false);

            // Create some criteria.....
            // Use the criteria in some way:
            myPeer.doUpdate(criteria, connection);
            myPeer2.doInsert(criteria2, connection);
            myPeer3.doDelete(criteria3, connection);

            // If all goes well, commit the changes
                connection.commit();
        }
        catch(Exception e)
        {
            // If problems occur - rollback
            connection.rollback();
        }
        finally
        {
            DBBroker.getInstance().releaseConnection(db);
        }
    }

Q?

1. Does using the DBBroker in this way provide a connection that uses the
properties from the props file?
2. Does the connection come from the pool? I don't want to create a new
stand-alone connection for obvious reasons.

The following comment above all methods that have a connection parameter,
confuses me:

/*

This method is to be used during a transaction,
otherwise use the doSelect(Criteria) method.  It will take care of
the connection details internally.

*/

What connection details will it take care of
Hope that this is all clear.

Gareth




------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to