You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Thomas Dudziak <to...@gmail.com> on 2005/04/12 18:25:53 UTC

Re: Collection-Factory

On Apr 12, 2005 7:16 PM, Martin Taal <mt...@springsite.com> wrote:
> Hi Thomas,
> I have tried my luck on the collection-factory thing and have made
> changes to ojb to allow a collection-factory in the collection
> descriptor. I have tested with my own test cases and have run the ojb
> test suite (which gave the same results as before my changes).
> 
> I have added the use of the collection-factory in the same locations
> where the collection-class was used.
> 
> However, what I noticed is that the actual creation of the collection is
> a bit spread out, the PersistenceBroker, MtoNCollectionPrefetcher and
> CollectionPrefetcher each have their own createCollection method. Which
> basically do the same thing. Also the PersistanceBroker forwards the
> createCollection to a componentcontainer.
> In different locations (in the above classes) a check is done if a field
> type is an array in which case the collection creation is also handled
> differently
> 
> To stay in line with the current approach I have added the
> collection-factory in all of the above locations.
> 
> But would it be an idea to put the create collection code in a more
> central location (CollectionDescriptor maybe?) and/or use a default
> CollectionFactoryImpl to also cover the current createCollection approach?
> 
> I also noticed another discussion between you and others about an issue
> with the collection creation (jira, OJB-19).
> 
> I am happy to send in my changes (as a patch) for the collection-factory
> but as you can see I am not sure if the changes should may be go a bit
> further.

Could you add it to the OJB-19 or, better yet, create a new issue ?
I'll work on it then.

regards,
Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Collection-Factory

Posted by Thomas Dudziak <to...@gmail.com>.
(I post this here because JIRA has problems right now and I cannot add
comments to the issues. I'll add this comment to the issue, as well,
once JIRA works normally again).

I think it is not that easy because the collection proxies instantiate
the collections on their own. E.g. see
org.apache.ojb.broker.core.proxy.AbstractCollectionProxy.
I've already added a collection factory mechanism (though not per
collection descriptor but rather per persistence configuration) which
I will subsequently enhance to also handle the proxy part and
additionally provide the object owning the collection. I'd rather like
to avoid the definition of the collection factory per
collection-descriptor and prefer a pluggable solution per persistence
configuration as it is more in line with the current architecture and
should be able to provide the same functionality. One benefit of this
way is that the collection factory can be created outside of OJB and
then plugged into it (which is not possible with the
per-collection-descriptor approach).

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org