You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Thierry Legrain <tl...@infovista.com> on 2003/12/17 17:54:58 UTC
PagingIterator: not really a scrollcursor!
Hi All,
I have a big problem with PagingIterator. This is a big show-stopper for me.
I really appreciate in RC5 the new PagingIterator (I need to use
scrollcursor since RC4) but your implementation has some problems.
First ==> in PagingIterator, when I use absolute or relative,
you don't resync m_currentCursorPosition
and hasNext() call releaseDbResources. It' not the
good solution, releaseDbResources is in charge of developer (see correction
attachment file).
Second ==> in PagingIterator, when you call next for the last
record, the rsIterator call releaseDbResources and mark result to close.
After this, if you call absolute or relative, you
have this error
java.util.NoSuchElementException: inner hasNext was false
And you lose all benefits of scrollcursor.
Thanks Much,
Thierry Legrain.
Re: PagingIterator: not really a scrollcursor!
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi thierry, armin,
i commited the fixes to both branches. releaseDbResources is not solved yet.
jakob
Jakob Braeuchi wrote:
> hi armin, thierry,
>
> there's another problem with relative and absolute in OJBIterator:
>
> boolean absolute(int row) throws PersistenceBrokerException;
>
> boolean relative(int row) throws SQLException;
>
> why does relative throw an SqlException ?
>
> jakob
>
> Armin Waibel wrote:
>
>> Hi again,
>>
>> Jakob Braeuchi wrote:
>>
>>> hi armin,
>>>
>>> afaik all iterators returned by pb are OJBIterators, so is the
>>> PagingIterator. and with a little help of a typecast...
>>
>>
>>
>> ok, that's what I mean. OJB couldn't know of that typecast and close
>> the resources if possible. We could introduce a flag to allow bypass
>> of the auto-resource-cleanup and let the user free resources
>> (setAutoRelease(false) or something similar).
>>
>> regards,
>> Armin
>>
>>>
>>> thierry, the patch you mentioned is not attached, please send it to
>>> my mail address.
>>>
>>> jakob
>>>
>>> Armin Waibel wrote:
>>>
>>>> Hi Thierry and Jakob,
>>>>
>>>> I changed RsIterator to be very strict in resource
>>>> (Statement/ResultSet) handling. To avoid abandoned
>>>> Statement/ResultSet instances we have to close resources as soon as
>>>> possible.
>>>>
>>>> >> Second è in PagingIterator, when you call next for
>>>> the last
>>>> >> record, the rsIterator call releaseDbResources and mark result
>>>> to close.
>>>> >> After this, if you call absolute or
>>>> relative,
>>>> >> you have this error
>>>>
>>>> What I don't understand, how can you call 'absolute' method,
>>>> Iterator interface does not support this method (PB-api only returns
>>>> Iterator instances, or I'm wrong?).
>>>>
>>>> regards,
>>>> Armin
>>>>
>>>> Jakob Braeuchi wrote:
>>>>
>>>>> hi thierry,
>>>>>
>>>>> you're right, this is a problem. i'll check the cursor-position asap.
>>>>> but i'm not sure about calling releaseDbResources.
>>>>>
>>>>> Thierry Legrain wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>>
>>>>>>
>>>>>> I have a big problem with PagingIterator. This is a big
>>>>>> show-stopper for me.
>>>>>>
>>>>>> I really appreciate in RC5 the new PagingIterator (I need to use
>>>>>> scrollcursor since RC4) but your implementation has some problems.
>>>>>>
>>>>>>
>>>>>>
>>>>>> First è in PagingIterator, when I use absolute or
>>>>>> relative, you don't resync m_currentCursorPosition
>>>>>>
>>>>>> and hasNext() call releaseDbResources. It'
>>>>>> not the good solution, releaseDbResources is in charge of
>>>>>> developer (see correction attachment file).
>>>>>>
>>>>>>
>>>>>>
>>>>>> Second è in PagingIterator, when you call next for the
>>>>>> last record, the rsIterator call releaseDbResources and mark
>>>>>> result to close.
>>>>>>
>>>>>> After this, if you call absolute or
>>>>>> relative, you have this error
>>>>>>
>>>>>> java.util.NoSuchElementException: inner hasNext was false
>>>>>>
>>>>>> And you lose all benefits of scrollcursor.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks Much,
>>>>>>
>>>>>> Thierry Legrain.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: PagingIterator: not really a scrollcursor!
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin, thierry,
there's another problem with relative and absolute in OJBIterator:
boolean absolute(int row) throws PersistenceBrokerException;
boolean relative(int row) throws SQLException;
why does relative throw an SqlException ?
jakob
Armin Waibel wrote:
> Hi again,
>
> Jakob Braeuchi wrote:
>
>> hi armin,
>>
>> afaik all iterators returned by pb are OJBIterators, so is the
>> PagingIterator. and with a little help of a typecast...
>
>
> ok, that's what I mean. OJB couldn't know of that typecast and close the
> resources if possible. We could introduce a flag to allow bypass of the
> auto-resource-cleanup and let the user free resources
> (setAutoRelease(false) or something similar).
>
> regards,
> Armin
>
>>
>> thierry, the patch you mentioned is not attached, please send it to my
>> mail address.
>>
>> jakob
>>
>> Armin Waibel wrote:
>>
>>> Hi Thierry and Jakob,
>>>
>>> I changed RsIterator to be very strict in resource
>>> (Statement/ResultSet) handling. To avoid abandoned
>>> Statement/ResultSet instances we have to close resources as soon as
>>> possible.
>>>
>>> >> Second è in PagingIterator, when you call next for the
>>> last
>>> >> record, the rsIterator call releaseDbResources and mark result
>>> to close.
>>> >> After this, if you call absolute or
>>> relative,
>>> >> you have this error
>>>
>>> What I don't understand, how can you call 'absolute' method, Iterator
>>> interface does not support this method (PB-api only returns Iterator
>>> instances, or I'm wrong?).
>>>
>>> regards,
>>> Armin
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi thierry,
>>>>
>>>> you're right, this is a problem. i'll check the cursor-position asap.
>>>> but i'm not sure about calling releaseDbResources.
>>>>
>>>> Thierry Legrain wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>>
>>>>>
>>>>> I have a big problem with PagingIterator. This is a big
>>>>> show-stopper for me.
>>>>>
>>>>> I really appreciate in RC5 the new PagingIterator (I need to use
>>>>> scrollcursor since RC4) but your implementation has some problems.
>>>>>
>>>>>
>>>>>
>>>>> First è in PagingIterator, when I use absolute or
>>>>> relative, you don't resync m_currentCursorPosition
>>>>>
>>>>> and hasNext() call releaseDbResources. It'
>>>>> not the good solution, releaseDbResources is in charge of
>>>>> developer (see correction attachment file).
>>>>>
>>>>>
>>>>>
>>>>> Second è in PagingIterator, when you call next for the
>>>>> last record, the rsIterator call releaseDbResources and mark
>>>>> result to close.
>>>>>
>>>>> After this, if you call absolute or
>>>>> relative, you have this error
>>>>>
>>>>> java.util.NoSuchElementException: inner hasNext was false
>>>>>
>>>>> And you lose all benefits of scrollcursor.
>>>>>
>>>>>
>>>>>
>>>>> Thanks Much,
>>>>>
>>>>> Thierry Legrain.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: PagingIterator: not really a scrollcursor!
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi again,
Jakob Braeuchi wrote:
> hi armin,
>
> afaik all iterators returned by pb are OJBIterators, so is the
> PagingIterator. and with a little help of a typecast...
ok, that's what I mean. OJB couldn't know of that typecast and close the
resources if possible. We could introduce a flag to allow bypass of the
auto-resource-cleanup and let the user free resources
(setAutoRelease(false) or something similar).
regards,
Armin
>
> thierry, the patch you mentioned is not attached, please send it to my
> mail address.
>
> jakob
>
> Armin Waibel wrote:
>
>> Hi Thierry and Jakob,
>>
>> I changed RsIterator to be very strict in resource
>> (Statement/ResultSet) handling. To avoid abandoned Statement/ResultSet
>> instances we have to close resources as soon as possible.
>>
>> >> Second è in PagingIterator, when you call next for the
>> last
>> >> record, the rsIterator call releaseDbResources and mark result to
>> close.
>> >> After this, if you call absolute or relative,
>> >> you have this error
>>
>> What I don't understand, how can you call 'absolute' method, Iterator
>> interface does not support this method (PB-api only returns Iterator
>> instances, or I'm wrong?).
>>
>> regards,
>> Armin
>>
>> Jakob Braeuchi wrote:
>>
>>> hi thierry,
>>>
>>> you're right, this is a problem. i'll check the cursor-position asap.
>>> but i'm not sure about calling releaseDbResources.
>>>
>>> Thierry Legrain wrote:
>>>
>>>> Hi All,
>>>>
>>>>
>>>>
>>>> I have a big problem with PagingIterator. This is a big show-stopper
>>>> for me.
>>>>
>>>> I really appreciate in RC5 the new PagingIterator (I need to use
>>>> scrollcursor since RC4) but your implementation has some problems.
>>>>
>>>>
>>>>
>>>> First è in PagingIterator, when I use absolute or
>>>> relative, you don't resync m_currentCursorPosition
>>>>
>>>> and hasNext() call releaseDbResources. It'
>>>> not the good solution, releaseDbResources is in charge of developer
>>>> (see correction attachment file).
>>>>
>>>>
>>>>
>>>> Second è in PagingIterator, when you call next for the
>>>> last record, the rsIterator call releaseDbResources and mark result
>>>> to close.
>>>>
>>>> After this, if you call absolute or
>>>> relative, you have this error
>>>>
>>>> java.util.NoSuchElementException: inner hasNext was false
>>>>
>>>> And you lose all benefits of scrollcursor.
>>>>
>>>>
>>>>
>>>> Thanks Much,
>>>>
>>>> Thierry Legrain.
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: PagingIterator: not really a scrollcursor!
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi armin,
afaik all iterators returned by pb are OJBIterators, so is the
PagingIterator. and with a little help of a typecast...
thierry, the patch you mentioned is not attached, please send it to my
mail address.
jakob
Armin Waibel wrote:
> Hi Thierry and Jakob,
>
> I changed RsIterator to be very strict in resource (Statement/ResultSet)
> handling. To avoid abandoned Statement/ResultSet instances we have to
> close resources as soon as possible.
>
> >> Second è in PagingIterator, when you call next for the last
> >> record, the rsIterator call releaseDbResources and mark result to
> close.
> >> After this, if you call absolute or relative,
> >> you have this error
>
> What I don't understand, how can you call 'absolute' method, Iterator
> interface does not support this method (PB-api only returns Iterator
> instances, or I'm wrong?).
>
> regards,
> Armin
>
> Jakob Braeuchi wrote:
>
>> hi thierry,
>>
>> you're right, this is a problem. i'll check the cursor-position asap.
>> but i'm not sure about calling releaseDbResources.
>>
>> Thierry Legrain wrote:
>>
>>> Hi All,
>>>
>>>
>>>
>>> I have a big problem with PagingIterator. This is a big show-stopper
>>> for me.
>>>
>>> I really appreciate in RC5 the new PagingIterator (I need to use
>>> scrollcursor since RC4) but your implementation has some problems.
>>>
>>>
>>>
>>> First è in PagingIterator, when I use absolute or
>>> relative, you don't resync m_currentCursorPosition
>>>
>>> and hasNext() call releaseDbResources. It'
>>> not the good solution, releaseDbResources is in charge of developer
>>> (see correction attachment file).
>>>
>>>
>>>
>>> Second è in PagingIterator, when you call next for the
>>> last record, the rsIterator call releaseDbResources and mark result
>>> to close.
>>>
>>> After this, if you call absolute or relative,
>>> you have this error
>>>
>>> java.util.NoSuchElementException: inner hasNext was false
>>>
>>> And you lose all benefits of scrollcursor.
>>>
>>>
>>>
>>> Thanks Much,
>>>
>>> Thierry Legrain.
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: PagingIterator: not really a scrollcursor!
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Thierry and Jakob,
I changed RsIterator to be very strict in resource (Statement/ResultSet)
handling. To avoid abandoned Statement/ResultSet instances we have to
close resources as soon as possible.
>> Second è in PagingIterator, when you call next for the last
>> record, the rsIterator call releaseDbResources and mark result to
close.
>> After this, if you call absolute or relative,
>> you have this error
What I don't understand, how can you call 'absolute' method, Iterator
interface does not support this method (PB-api only returns Iterator
instances, or I'm wrong?).
regards,
Armin
Jakob Braeuchi wrote:
> hi thierry,
>
> you're right, this is a problem. i'll check the cursor-position asap.
> but i'm not sure about calling releaseDbResources.
>
> Thierry Legrain wrote:
>
>> Hi All,
>>
>>
>>
>> I have a big problem with PagingIterator. This is a big show-stopper
>> for me.
>>
>> I really appreciate in RC5 the new PagingIterator (I need to use
>> scrollcursor since RC4) but your implementation has some problems.
>>
>>
>>
>> First è in PagingIterator, when I use absolute or
>> relative, you don't resync m_currentCursorPosition
>>
>> and hasNext() call releaseDbResources. It' not
>> the good solution, releaseDbResources is in charge of developer (see
>> correction attachment file).
>>
>>
>>
>> Second è in PagingIterator, when you call next for the last
>> record, the rsIterator call releaseDbResources and mark result to close.
>>
>> After this, if you call absolute or relative,
>> you have this error
>>
>> java.util.NoSuchElementException: inner hasNext was false
>>
>> And you lose all benefits of scrollcursor.
>>
>>
>>
>> Thanks Much,
>>
>> Thierry Legrain.
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: PagingIterator: not really a scrollcursor!
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi thierry,
you're right, this is a problem. i'll check the cursor-position asap.
but i'm not sure about calling releaseDbResources.
Thierry Legrain wrote:
> Hi All,
>
>
>
> I have a big problem with PagingIterator. This is a big show-stopper for
> me.
>
> I really appreciate in RC5 the new PagingIterator (I need to use
> scrollcursor since RC4) but your implementation has some problems.
>
>
>
> First è in PagingIterator, when I use absolute or
> relative, you don't resync m_currentCursorPosition
>
> and hasNext() call releaseDbResources. It' not
> the good solution, releaseDbResources is in charge of developer (see
> correction attachment file).
>
>
>
> Second è in PagingIterator, when you call next for the last
> record, the rsIterator call releaseDbResources and mark result to close.
>
> After this, if you call absolute or relative,
> you have this error
>
> java.util.NoSuchElementException: inner hasNext was false
>
> And you lose all benefits of scrollcursor.
>
>
>
> Thanks Much,
>
> Thierry Legrain.
>
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: PagingIterator: not really a scrollcursor!
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi thierry,
you're right, this is a problem. i'll check the cursor-position asap.
but i'm not sure about calling releaseDbResources.
Thierry Legrain wrote:
> Hi All,
>
>
>
> I have a big problem with PagingIterator. This is a big show-stopper for
> me.
>
> I really appreciate in RC5 the new PagingIterator (I need to use
> scrollcursor since RC4) but your implementation has some problems.
>
>
>
> First è in PagingIterator, when I use absolute or
> relative, you don't resync m_currentCursorPosition
>
> and hasNext() call releaseDbResources. It' not
> the good solution, releaseDbResources is in charge of developer (see
> correction attachment file).
>
>
>
> Second è in PagingIterator, when you call next for the last
> record, the rsIterator call releaseDbResources and mark result to close.
>
> After this, if you call absolute or relative,
> you have this error
>
> java.util.NoSuchElementException: inner hasNext was false
>
> And you lose all benefits of scrollcursor.
>
>
>
> Thanks Much,
>
> Thierry Legrain.
>
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org