Hi Sean,

recommended to use the second alternative.
We introduced a TransactionExt interface in rc5, this encapsulates the proprietary extensions of odmg.Transaction. Thus you can cast tx to TransactionExt too.


> Transaction tx = odmg.newTransaction();
> tx.begin();
> PersistenceBroker broker = ((TransactionExt) tx).getBroker();

see
http://db.apache.org/ojb/api/org/apache/ojb/odmg/TransactionExt.html

regards,
Armin

Sean Dockery wrote:
If my application is using the ODMG personality of OJB a la...

Implementation odmg = OBJ.getInstance();
...

Is it safe for other parts of my code to use a PersistenceBroker like
this...

PersistenceBroker broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
try {
    // ...
}
finally {
    broker.close();
}

...or should I always (on pain of death) get a PersistenceBroker like
this...

Implementation odmg = OJB.getInstance();
Transaction tx = odmg.newTransaction();
tx.begin();
PersistenceBroker broker = ((HasBroker) tx).getBroker();
//...
tx.commit();





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






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



Reply via email to