cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: transactions vs iterated query
Date Thu, 06 Jan 2011 09:08:11 GMT

On Jan 6, 2011, at 10:48 AM, Hans Pikkemaat wrote:

> One library calls the other one.
> The first one is using the iterated query to get some data. It will call the second
> library to process the data.

IMO this first library (iterator control code) should be the place that does transaction switching,
transparently to the second library. E.g. in lib1:

try {
  while(it.hasNext()) {
    Map nextRow = it.next();

    // save current tx in a local ivar
    try {
       // set current tx to NULL
       // call lib2
    }
    finally {
       // restore tx
    }

  }
}
finally {
   it.close();
}

> 
> Now you could say that this is a design flaw. 

IMO it is.

Andrus
Mime
View raw message