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.  
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

whereas this code is safe:

PersistenceBroker mypb = PBFactory.defaultPersistenceBroker();
mypb.beginTransaction();
//store
mypb.commitTransaction();

Maybe the first example isn't a problem - I could be 
misunderstanding how transactions work under the covers.  Can 
anyone clarify this for me?

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>

Reply via email to