Hi Steve, [EMAIL PROTECTED] wrote:
I took my first look through the PB Factory-related code today and have a question.
It looks like when you call PBFactory.defaultPersistenceBroker(), you just get whatever persistenceBroker instance is next in the pool.
correct!
So if I want to write a some transactional code, would it be correct to say that this code is not safe:
PBFactory.defaultPersistenceBroker().beginTransaction();
//store
PBFactory.defaultPersistenceBroker().commitTransaction();
//unsafe because I could be getting a different PB instance back than the one i used to call beginTransaction on
correct!
whereas this code is safe: PersistenceBroker mypb = PBFactory.defaultPersistenceBroker(); mypb.beginTransaction(); //store mypb.commitTransaction();
correct!
Maybe the first example isn't a problem - I could be misunderstanding how transactions work under the covers. Can anyone clarify this for me?You are right. The PersistenceBrokerFactory maintains a pool of broker instance for each repository. The defaultPB represents the default repository.
cheers,
Thomas
Thanks, Steve -- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
-- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
