wilson lists wrote:
I need to run a plain SQL Update inside a PersistenceBroker
transaction. The DBMS is Oracle 8.



Trimming your example a bit:
            broker = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
            broker.beginTransaction();
              conn = broker.serviceConnectionManager().getConnection();
...
broker.commitTransaction();
}finally{
if(broker != null){
broker.serviceConnectionManager().releaseConnection();
broker.close();
}
}

Everything looks fine, and you are following all contracts for freeing resources by having finally{close statement} for the statement that you got directly from the Connection object (OJB can't keep track of this one).

You should just remove the call to:
 broker.serviceConnectionManager().releaseConnection();

This will be done automatically on broker.close(), see:
 
http://db.apache.org/ojb/docu/guides/connection.html#Can+I+directly+obtain+a%0A++++++++++++++++

(Horrible link... if it doesn't work, scroll down to the end of:
 http://db.apache.org/ojb/docu/guides/connection.html)

Regards,
 Martin


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



Reply via email to