Hi Jair Jr.,

Jair da Silva Ferreira Júnior wrote:

Hi,
    I am using ojb1.0_rc4, ODMG api with OJB queries and mysql4.
    When running OJB queries using the broker, is it necessary to begin, commit or 
abort the broker transaction?
    Which one should I use? Example 1 or 2?
hmm, if you start an odmg-transaction and obtain a PB instance via
PersistenceBroker broker = ((HasBroker) transaction).getBroker();
I would recommend not to do any PB-transaction action. So 2)
should be ok, because you only do read-operations.

regards,
Armin


1) ...
PersistenceBroker broker = ((HasBroker) transaction).getBroker();
broker.beginTransaction();
Iterator it=broker.getIteratorByQuery(q); //do something with the iterator
broker.commitTransaction(); ...

    2)
        ....
        PersistenceBroker broker = ((HasBroker) transaction).getBroker();
        Iterator it=broker.getIteratorByQuery(q);
        //do something with the iterator
        ....

Thanks,
    Jair Jr



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



Reply via email to