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 Jakob Braeuchi <jb...@gmx.ch> on 2004/10/17 17:13:11 UTC
[Fwd: Re: ClassCastException in QueryReferenceBroker.]
hi all,
imo we have a problem with the interface CollectionProxy and the implementig
class CollectionProxyDefaultImpl. in most cases the impl-class is used instead
of programming against the interface. this may lead to class-cast-exceptions ;)
i think we should cleanup such things for 1.1.
jakob
Re: [Fwd: Re: ClassCastException in QueryReferenceBroker.]
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi all,
i commited the refactored classes.
jakob
Jakob Braeuchi schrieb:
> hi all,
>
> imo we have a problem with the interface CollectionProxy and the
> implementig class CollectionProxyDefaultImpl. in most cases the
> impl-class is used instead of programming against the interface. this
> may lead to class-cast-exceptions ;)
>
> i think we should cleanup such things for 1.1.
>
> jakob
>
> ------------------------------------------------------------------------
>
> Betreff:
> Re: ClassCastException in QueryReferenceBroker.
> Von:
> Jakob Braeuchi <jb...@gmx.ch>
> Datum:
> Sun, 17 Oct 2004 16:33:25 +0200
> An:
> OJB Users List <oj...@db.apache.org>
>
> An:
> OJB Users List <oj...@db.apache.org>
>
>
> hi paul,
>
> i think this problem should disappear when usinf proxy-prefetching-limit
> = 0.
> see QueryReferenceBroker#retrieveCollection
>
> ...
>
> if (prefetchProxies && (m_retrievalTasks != null)
> && (cds.getProxyPrefetchingLimit() > 0)
> <<<<<<
> && (cds.getQueryCustomizer() == null)
> && (ProxyHelper.isCollectionProxy(value)))
> {
> if (addRetrievalTask(obj, cds))
> {
> new PBCollectionProxyListener(obj,
> m_retrievalTasks, cds,
> cds.getProxyPrefetchingLimit());
> }
> }
> ...
>
> but imo this is not the way to do it. i assume that that
> class-cast-exception occurs when casing to CollectionProxyDefaultImpl:
>
> protected void addThisListenerTo(Object owner)
> {
> PersistentField collectionField =
> ((CollectionDescriptor) _key).getPersistentField();
> _listenedCollection = (CollectionProxyDefaultImpl)
> collectionField.get(owner); <<<<<<<
> _listenedCollection.addListener(this);
> }
>
> can you confirm this ? what class is returned by
> collectionField.get(owner) ?
>
> jakob
>
> Nase, Paul R. schrieb:
>
>> We are currently on OJB RC6 and cannot move to OJB 1.0 at this time
>> due to product release schedules. During multi-user/load testing, we
>> occasionally see the following ClassCastException occurring:
>>
>> Caused by: java.lang.ClassCastException
>> at
>> org.apache.ojb.broker.core.QueryReferenceBroker$PBCollectionProxyListener.addThisListenerTo(QueryReferenceBroker.java:835)
>>
>> at
>> org.apache.ojb.broker.core.QueryReferenceBroker$PBPrefetchingListener.<init>(QueryReferenceBroker.java:757)
>>
>> at
>> org.apache.ojb.broker.core.QueryReferenceBroker$PBCollectionProxyListener.<init>(QueryReferenceBroker.java:828)
>>
>> at
>> org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollection(QueryReferenceBroker.java:510)
>>
>> at
>> org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollections(QueryReferenceBroker.java:656)
>>
>> at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1291)
>>
>> at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1371)
>>
>> at
>> org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(QueryReferenceBroker.java:309)
>>
>> at
>> org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(QueryReferenceBroker.java:361)
>>
>> at
>> org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:472)
>>
>>
>>> From past postings, it appears that this could eliminated by setting
>>> proxy-prefetching-limit to 0. Could someone confirm if this is a
>>> correct resolution for these errors and also give me an idea of how
>>> this may impact our current performance?
>>
>>
>> Thanks in advance,
>>
>> Paul
>>
>> ---------------------------------------------------------------------
>> 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-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