[Opensource] Transaction Isolation

Michael Rimov rimovm at centercomp.com
Tue Jul 23 22:19:00 PDT 2002


At 11:51 PM 7/22/2002 -0500, you wrote:
>I have a situation where I need to control the transaction isolation on a 
>database connection.  It seems that DBObjects and/or DBConnection do not 
>support this ability?  Has anyone been able to do this while still using 
>DBObjects?

Aime,

If you modify DBConnection to add:
                 get/setTransactionIsolation(int level)

as well as have it throw a DBException if the underlying database driver 
can't handle the requested transaction isolation you'd be set.  It wouldn't 
be hard to modify DBConnection to do that.

Then every time you create a DBObject with that connection in it's 
constructor.  So you would have something like:

         DBConnection myConnection = myPool.getConnection();
         myConnection.setTransactionIsolationLevel(whatever you want);
         MyDBOBject dbobj = new DBObject(myConnection);
         dbobj.setExpUid(SecuredDBObject.SYSTEM_ACCOUNT);
         dbobj.setDBName(whatever you want);

         //
         //do whatever you want.
         //

Anyway, that will do what you want with minimal code changes.

HTH!
                                         -Mike







More information about the Opensource mailing list