[prev in list] [next in list] [prev in thread] [next in thread]
List: ojb-user
Subject: Re: clear() && collection proxy && RemovalAware
From: Jakob Braeuchi <jbraeuchi () gmx ! ch>
Date: 2004-04-30 20:14:36
Message-ID: 4092B3AC.9040105 () gmx ! ch
[Download RAW message or body]
hi armin,
i fixed it.
jakob
Armin Waibel wrote:
>
>
> Jakob Braeuchi wrote:
>
>> hi armin,
>>
>> you're right. but imo we should only force a load if the collection is
>> removal aware. i do not like the idea of loading objects to clear a
>> list...
>>
>
> sounds good! To check the collection type seems the best solution...
>
> Armin
>
>> jakob
>>
>> Armin Waibel wrote:
>>
>>> Hi Jakob,
>>>
>>> I'm not sure if this will solve the problem with removal aware list
>>> implementation, because removal aware list only recognise loaded
>>> objects. If clear was called on the proxy and data was not loaded the
>>> objects will not be passed to the removal aware list.
>>> So load data may be mandatory on clear call?
>>>
>>> regards,
>>> Armin
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi edson, armin,
>>>>
>>>> i checked it in.
>>>>
>>>> jakob
>>>>
>>>> Jakob Braeuchi wrote:
>>>>
>>>>> hi edson, armin,
>>>>>
>>>>> imo the correct fix is as follows:
>>>>>
>>>>> ..
>>>>> // ECER: assure it will notify all being removed, necessary
>>>>> for RemovalAware classes...
>>>>> if (isLoaded())
>>>>> {
>>>>> getData().clear();
>>>>> }
>>>>> ..
>>>>>
>>>>> otherwise the clear will fire a load.
>>>>>
>>>>> jakob
>>>>>
>>>>> Edson Carlos Ericksson Richter wrote:
>>>>>
>>>>>> Sorry, I don't wanna be boring...
>>>>>>
>>>>>> Armin Waibel wrote:
>>>>>>
>>>>>>> Hi Edson,
>>>>>>>
>>>>>>> I'm not familiar with the proxy stuff, so be patience...
>>>>>>>
>>>>>>> edson.richter@mgrinformatica.com.br wrote:
>>>>>>>
>>>>>>>> Is this already in CVS? This fix is correct?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Edson Richter
>>>>>>>>
>>>>>>>>
>>>>>>>>> After some research, I've found an implementation that works:
>>>>>>>>>
>>>>>>>>> public void clear()
>>>>>>>>> {
>>>>>>>>> Collection coll;
>>>>>>>>>
>>>>>>>>> if(getData()instanceof ManageableCollection) {
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> getData() will materialize the whole collection on each clear
>>>>>>> call. Is this the expected behaviour or should we check loading
>>>>>>> status before perfrom your changes?
>>>>>>>
>>>>>>> regards,
>>>>>>> Armin
>>>>>>>
>>>>>>>>> getData().clear(); // ECER: assure it will notify all
>>>>>>>>> being
>>>>>>>>> removed, necessary for RemovalAware classes...
>>>>>>>>> } else {
>>>>>>>>> // BRJ: use an empty collection so isLoaded will return true
>>>>>>>>> try
>>>>>>>>> {
>>>>>>>>> coll = (Collection) getCollectionClass().newInstance();
>>>>>>>>> }
>>>>>>>>> catch (Exception e)
>>>>>>>>> {
>>>>>>>>> coll = new ArrayList();
>>>>>>>>> }
>>>>>>>>> setData(coll);
>>>>>>>>> _size = 0;
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Could someone cofirm/fix this in CVS?
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Edson Richter
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Edson Carlos Ericksson Richter wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> I think I and a co-worker (Igor) found a little bug in
>>>>>>>>>> collection
>>>>>>>>>> proxy. When using RemovalAware... as class for a collection
>>>>>>>>>> descriptor, calling clear() in the collection don't register the
>>>>>>>>>> objects for deletion. The answer is the clear implementation in
>>>>>>>>>> CollectionProxyDefaultImpl:
>>>>>>>>>>
>>>>>>>>>> public void clear()
>>>>>>>>>> {
>>>>>>>>>> Collection coll;
>>>>>>>>>>
>>>>>>>>>> // BRJ: use an empty collection so isLoaded will return true
>>>>>>>>>> try
>>>>>>>>>> {
>>>>>>>>>> coll = (Collection) getCollectionClass().newInstance();
>>>>>>>>>> }
>>>>>>>>>> catch (Exception e)
>>>>>>>>>> {
>>>>>>>>>> coll = new ArrayList();
>>>>>>>>>> }
>>>>>>>>>> setData(coll);
>>>>>>>>>> _size = 0;
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> I think the right method should be:
>>>>>>>>>>
>>>>>>>>>> public void clear()
>>>>>>>>>> {
>>>>>>>>>> Collection coll;
>>>>>>>>>> getData().clear(); // ECER: assure it will notify all being
>>>>>>>>>> removed, necessary for RemovalAware classes...
>>>>>>>>>>
>>>>>>>>>> // BRJ: use an empty collection so isLoaded will return true
>>>>>>>>>> try
>>>>>>>>>> {
>>>>>>>>>> coll = (Collection) getCollectionClass().newInstance();
>>>>>>>>>> }
>>>>>>>>>> catch (Exception e)
>>>>>>>>>> {
>>>>>>>>>> coll = new ArrayList();
>>>>>>>>>> }
>>>>>>>>>> setData(coll);
>>>>>>>>>> _size = 0;
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> Could you analize and report if this is right?
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>> Edson Richter
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>>>>>>> For additional commands, e-mail: ojb-user-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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>>>>> For additional commands, e-mail: ojb-user-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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>>> For additional commands, e-mail: ojb-user-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
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic