hi steve,

this problem is already fixed in the current revision in cvs. i fixed it in
ClassDescriptor#getKeyValues.

hth
jakob

----- Original Message -----
From: "sclark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 17, 2002 6:01 PM
Subject: singlevm PB bug: proxies in MtoN relationships


> I think I've found a bug in the singlevm PersistenceBrokerImpl.  The
problem
> occurs when the target of a many-to-many relationship is a proxied class
and the
> indirection table is implicit.  In 0.9.7 I get exceptions like the
following:
>
> [org.apache.ojb.odmg.ObjectEnvelopeTable] ERROR: Commit on object level
failed
> for tx org.apache.ojb.odmg.TransactionImpl@593225
> $Proxy54 not found in OJB Repository
> org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException:
$Proxy54 not
> found in OJB Repository
> at
>
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Descrip
torR
> epository.java:322)
> at
>
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Descrip
torR
> epository.java:310)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeMtoNImplementor(Pe
rsis
> tenceBrokerImpl.java:766)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeCollections(Persis
tenc
> eBrokerImpl.java:725)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker
Impl
> .java:1615)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker
Impl
> .java:1539)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker
Impl
> .java:1525)
>
> It appears that the problem is that storeMtoNImplementor does not check
for
> otherObj being a proxy and does not retrieve its realSubject.  I added
this
> code:
>
>             if (otherObj instanceof VirtualProxy)
>             {
>                 otherObj = ((VirtualProxy) otherObj).getRealSubject();
>             }
>             // same for dynamic Proxies
>             else if (Proxy.isProxyClass(otherObj.getClass()))
>             {
>                 IndirectionHandler handler = (IndirectionHandler)
> Proxy.getInvocationHandler(otherObj);
>                 otherObj = handler.getRealSubject();
>             }
>
> ... before the declaration of otherCld, and the problem went away.
Anybody want
> to comment and/or commit a fix?
>
> thanks,
> -steve
>
> Steve Clark
> Technology Applications Team
> Natural Resources Research Center/USGS
> [EMAIL PROTECTED]
> (970)226-9291
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>


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

Reply via email to