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(DescriptorR
epository.java:322)
at
org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(DescriptorR
epository.java:310)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeMtoNImplementor(Persis
tenceBrokerImpl.java:766)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeCollections(Persistenc
eBrokerImpl.java:725)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBrokerImpl
.java:1615)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBrokerImpl
.java:1539)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBrokerImpl
.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]>