db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thierry Legrain <tlegr...@infovista.com>
Subject RE: PagingIterator: not really a scrollcursor!
Date Thu, 18 Dec 2003 09:47:32 GMT
FIRST
I have a problem with your fix. The computing of m_currentCursorPosition is
wrong for absolute method. If you try first absolute(200) and second
absolute(10) in a loop hasNext method return false after some iteration.
I re-mail you my fix.

SECOND
With my fix, the same problem occurs in
org.apache.ojb.broker.accesslayer.RsIterator after some iteration

NOTE: I agree with setAutoRelease

Thanks.
Thierry.


Example:

iter = dbBroker_.getIteratorByQuery(query);
while () {
	pagingIterator.absolute(1000);	
	i = 0;
	while (i < 10) {
		i++;
            Object o = iter.next();
	}
	pagingIterator.absolute(10);	
	i = 0;
	while (i < 10) {
		i++;
            Object o = iter.next();
	}}

-----Original Message-----
From: Jakob Braeuchi [mailto:jbraeuchi@gmx.ch] 
Sent: Wednesday, December 17, 2003 21:40 PM
To: OJB Developers List; tlegrain@infovista.com; Armin Waibel
Subject: Re: PagingIterator: not really a scrollcursor!

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
> 
> 



Mime
View raw message