Hi,
i noticed that when i prefetch a relationship, the collection-class
setting in the mapping is ignored. i always get a
removalAwareCollection.
i looked around in the code and came up with the attached patch to 1.0
RC4 that solves the problem.
i don't know if this is the right way to fix it, or if the problem is in
some other place. i was wondering why no one noticed this before.
hope the fix is ok and will make it into cvs.
Cheers,
Michael
--- RelationshipPrefetcherImpl.java.orig 2003-07-27 14:25:00.000000000 +0200
+++ RelationshipPrefetcherImpl.java 2003-09-24 18:28:08.000000000 +0200
@@ -61,6 +61,7 @@
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.PersistenceBrokerFactory;
import org.apache.ojb.broker.metadata.ClassDescriptor;
+import org.apache.ojb.broker.metadata.CollectionDescriptor;
import org.apache.ojb.broker.metadata.DescriptorRepository;
import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
import org.apache.ojb.broker.query.Query;
@@ -139,7 +140,15 @@
for (int i = 0; i < queries.length; i++)
{
+ if (getObjectReferenceDescriptor() instanceof CollectionDescriptor)
+ {
+ CollectionDescriptor collectionDescriptor = (CollectionDescriptor) getObjectReferenceDescriptor();
+ children = (Collection) getBroker().getCollectionByQuery(collectionDescriptor.getCollectionClass(), queries[i]);
+ }
+ else
+ {
children = getBroker().getCollectionByQuery(queries[i]);
+ }
associateBatched(owners, children);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]