Hi, We do something similar (for different reasons).
We use a thin layer (closed source, sorry) above the OJB layer, and have created simple lazyBegin, lazyCommit methods that respectively open and close the pb transaction - lazyBegin begins a transaction if one has not already been started and returns a boolean to say whether or not it started a new tx. That boolean is then passed into lazyCommit which only commits if it is true. Code extracts below : essentially, if the BusinessService is called from JUnit, JUnit controls the transaction. If the business service is called from elsewhere, the business service controls the transaction. HTH a bit, Cheers, Charles. Junit : boolean startedTx = UnitOfWork.begin(); // Explicitly and definitively start the TX ... access BusinesService here. UnitOfWork.rollback(); // Explicitly and definitively roll back TX BusinessService : boolean startedTx = UnitOfWork.lazybegin(); ..... Stuff UnitOfWork.lazyCommit(startedTx); UnitOWork (extract) : public static boolean lazyBegin() { boolean txStarted = false; if (!isBegun()) { begin(); // Starts pb (actually ODMG) transaction txStarted = true; } return txStarted; } public static void lazyCommit(boolean callerStartedTransaction) { if (callerStartedTransaction && isBegun()) { commit(); // Commits pb (actually ODMG) transaction } } > -----Original Message----- > From: Frank Renaers [mailto:[EMAIL PROTECTED] > Sent: 16 September 2004 08:22 > To: OJB Users List > Subject: RE: Transaction Isolation Level > > > Hi Armin, > > Thanks for your support. > Another question : > In our application there's a business service layer which is > in fact a kind of façade for the bo (ojb) layer. > Each business service starts a transaction and does a commit > or rollback at the end. > But when we are running junit tests, we do not want any commits. > We prefer to do a rollback at the end of the test. > Is there a way to pass a Transaction Context from the junit-test to > the business service method (without using a ejb-server). > > Greetings, > > Frank > > > > -----Original Message----- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: woensdag 15 september 2004 19:04 > To: OJB Users List > Subject: Re: Transaction Isolation Level > > Hi Frank, > > Frank Renaers wrote: > > > Hi, > > > > > > > > We are using the low level PersistenceBroker API (Version 1.0.0). > > > > Is there a way to specify the database transaction isolation level ? > > > > Sorry, there is no configuration flag for DB-tx isolation > level within OJB. > You can extend the used ConnectionFactory implementation and override > method #initializeJdbcConnection to set the isolation level. > > If you want to change the isolation level at runtime you can > extend the > used ConnectionFactory and override #returnConnectionToPool > to set the > default isolation level and at runtime do a > broker.serviceConnectionManager#getConnection() to change the level > before start with PB-operation. > > regards, > Armin > > > > > > > Thanks, > > > > > > > > Frank Renaers > > > > Ikan Software > > > > > > --------------------------------------------------------------------- > 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] > > ___________________________________________________________ HPD Software Ltd. - Helping Business Finance Business Email terms and conditions: www.hpdsoftware.com/disclaimer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]