db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: [OJB 1.1] inconsistent collections
Date Sun, 14 Nov 2004 12:40:59 GMT
hi all,

i found a small problem in RemovalAwareCollection.

assume the collection holds Proxies of Article and we try to delete a real 
materialized Article. see OneToManyTest#testDeleteWithRemovalAwareCollection().

the old implementation of RemovalAware collection did not check whether the 
object to be removed is part of the collection:

     /**
      * @see java.util.Collection#remove(Object)
      */
     public boolean remove(Object o)
     {
         boolean result = super.remove(o);
         registerForDeletion(o);
         return result;
     }

so it registered any object for deletion, no matter if it's part of the collection.

the new implementation checks the result of the remove before registering an object:

     /**
      * @see java.util.Collection#remove(java.lang.Object)
      */
     public boolean remove(Object o)
     {
         boolean result = super.remove(o);

         if (result)
         {
             registerDelete(o);
         }
         return result;
     }

that's why the new implementation fails on the above mentioned testcase.
imo this is the correct way of doing it, but it is no longer compatible with the 
old implementation. what do you think ?

jakob


Jakob Braeuchi schrieb:

> hi all,
> 
> i have finished the new collections and would like to check it in. the 
> implementation is _not_ based on commons-collections but the abstract 
> classes could easily replaced by decorators from commons-collections.
> 
> many of the old collections are deprecated an i would like to resolve 
> this issue after check in of the new collections.
> 
> are there any other work in progress in this area ?
> 
> jakob
> 
> Jakob Braeuchi schrieb:
> 
>> hi all,
>>
>> i'd like to use commons-collection 3.x to refactor our collections.
>>
>> afaik torque 3.0.2 does not work with this version of 
>> commons-collections.
>> there was a post by tom about integrating commomns-sql 
>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgNo=7465

>>
>>
>> can we now get rid of torque, or switch to a newer version ?
>>
>> jakob
>>
>> Jakob Braeuchi schrieb:
>>
>>> hi all,
>>>
>>> i was having a look at our collection in package 
>>> org.apache.ojb.broker.util.collections.
>>>
>>> i think we have a problem with the naming and implementation of these 
>>> collection. ie. RemovalAwareCollection is actually a 
>>> RemovalAware_Vector_ and thus a List. on the other side the 
>>> RemovalAwareList is never used.
>>>
>>> imo we also use too much inheritance instead of using composition. so 
>>> here's an opportunity for improvemnet/refactoring ;)
>>>
>>> jakob
>>>
>>> ---------------------------------------------------------------------
>>> 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