Hi all,

> I have the same problem
> but this bug is not fix !!

I try to write a test case for this problem without success, my test always pass. I use latest from CVS.

I do setup main object and collection object, in class-descriptor for Gatherer I set proxy="true" for collection-descriptor manage CollectiblesB instances (auto-retrieve="true", auto-update="true")

        Gatherer gat = new Gatherer(null, name);
        CollectibleB[] cols = prepareCollectibleB(name);

        gat.setCollectiblesB(Arrays.asList(cols));
        broker.beginTransaction();
        broker.store(gat);
        broker.commitTransaction();

broker.clearCache();

Lookup the stored object using a query
        Criteria crit = new Criteria();
        crit.addLike("name", name);
        Query q = QueryFactory.newQuery(Gatherer.class, crit);
        Gatherer newGat = (Gatherer)broker.getObjectByQuery(q);

Create an Iterator and materialize all references
        Iterator it = newGat.getCollectiblesB().iterator();
        int i = 0;
        while(it.hasNext())
        {
            CollectibleB colB = (CollectibleB) it.next();
            assertTrue(colB.getName().indexOf(name) > -1);
            i++;
        }
        assertEquals(4, i);

Is this test different from yours?

regards,
Armin

Joćo Mota wrote:
Hi, i am also having the same problem with rc5.



-----Original Message-----
From: Reda Benzair [mailto:[EMAIL PROTECTED] Sent: terēa-feira, 17 de Fevereiro de 2004 15:06
To: OJB Users List
Subject: Re: proxy loading issue from rc4 -> rc5



hi Frank I have the same problem but this bug is not fix !!

this is my last mail
I am experimenting random crashes in OJB RC5 : ClassCastException in QueryReferenceBroker$PBCollectionProxyListener.addThisListenerTo(CollectionP
roxy ) trying to cast into CollectionProxy:
protected void addThisListenerTo(Object listenedObject)
{
+ /*MODIFICATION AWAITING OJB'sTEAM REAL CORRECTION*/
+ if(listenedObject==null || !(listenedObject instanceof
CollectionProxy))
+ {
+ log.warn("The listenedObject is no
CollectionProxy. Cannot get registered! " + listenedObject);
+ }
+ else
+ {
_listenedCollection = (CollectionProxy) listenedObject;
_listenedCollection.addListener(this);
+ }
+ /*END MODIFICATION AWAITING OJB'sTEAM REAL CORRECTION*/
}


but this modif generate others error !



Hi,

I think there's a wrong behaivour in 1.0 rc5.
(with 1.0 rc4 it works well)

I have an Object with holds a collection of other objects
the loading of the collection is realized wih "proxy=true"
The Class Descriptor is correct (it works with 1.0 rc4)

public class SecondObject
{
        int pkey;
        .....
}

public class FirstObject
{
        int pkey; ....
        Collection manySecondObjects;
}

If I do the following:

<code>
Collection firstObjects =  firstObjectPeer.getAll();

// .. get 1 Object from Collection (Iterator code missing, only for
understanding)
FirstObject firstObject = (FirstObject)firstObjects.next();

Iterator i = firstObject .getManySecondObjects().iterator(); //here comes the Exception with 1.0 rc5

//do anything with every second Object
//...
</code>

If I try to get the Iterator for "ManySecondObjects"
it works well with 1.0 rc4
but with 1.0 rc5 it throws an exception (see below)
It seems to be, that the proxy dynamic loads works not in any case

but if i catch it and ask again for the Iterator
<code>
Iterator i = firstObject .getManySecondObjects().iterator();
</code>

it works
It looks like:
Trying once to load the collections throws the exception
but also sets a setting in the right way, so the second try works.

but if I load again the firstObject, it does not work,
at the first time trying to access the collection, only at the second time (and all following tries)


Maybe I am doing sth.  wrong or
maybe someone could confirm this behaivour.

Exception with 1.0 rc5 org.apache.ojb.broker.PersistenceBrokerException
java.lang.ClassCastException
      at
org.apache.ojb.broker.core.QueryReferenceBroker$PBCollectionProxyListener.a

d


dThisListenerTo(Unknown Source)
      at
org.apache.ojb.broker.core.QueryReferenceBroker$PBPrefetchingListener.prefe

t


ch(Unknown Source)
      at
org.apache.ojb.broker.core.QueryReferenceBroker$PBCollectionProxyListener.b

e


foreLoading(Unknown Source)
      at
org.apache.ojb.broker.accesslayer.CollectionProxy.beforeLoading(Unknown
Source)
      at
org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(Unknown Source)
      at org.apache.ojb.broker.accesslayer.ListProxy.loadData(Unknown
Source)
      at

org.apache.ojb.broker.accesslayer.CollectionProxy.getData(Unknown


Source)
      at
org.apache.ojb.broker.accesslayer.CollectionProxy.iterator(Unknown Source)


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to