db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leandro Rodrigo Saad Cruz <lean...@ibnetwork.com.br>
Subject [RFC] Defensive copies on store/delete
Date Thu, 17 Apr 2003 16:03:32 GMT
Hi all.

I'm trying to build a generic PersistenceManager using OJB and have
thise issues !


I want my business object to be independent of the persistence api used,
instead, I want them to implement BusinessObject that has the following
methods :

before/afterXXX() {Update,Add,Remove,Lookup}

On this methods I can implement particular business logic
(saving/removing files, adding/removing object from lists, etc).


If I want to change a collection that OJB is using on 


I get a java.util.ConcurrentModificationException
because OJB is using a Iterator on the same collection I'm trying to
modify ! To SOLVE this problem I have to make OJB use defensive copies
of collections before iterating through them !

I can't think of any problem that this change should rise besides
performance ones.

I made a simple modification on deleteCollections and all tests (the
ones that were passing) still pass !

If there are no objections I'll implement this !

Maybe a flag on reference/collection descriptors to indicate that a
defensive copy should be used is fine !

Any comments ??

Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)

View raw message