cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Pikkemaat <h.pikkem...@tsi-solutions.nl>
Subject Re: transactions vs iterated query
Date Thu, 06 Jan 2011 13:21:22 GMT
Hi,

That sounds logical but the issue could be that the calling party is simply not aware that
the
called library is using cayenne.

This would mean that an application which is calling some library always should clear
(and keep) the transaction. This is not very logical.

And what about the other example with the exception? Is there a way to call the close
method on the result iterator without exposing the ResultIterator to the calling party?

tx

Hans

On 1/6/11 10:08 AM, Andrus Adamchik wrote:
> 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