Hi all.

I have a weird case (using Cayenne 4.0-M2) where if I add a prefetch to a 
relationship, the relationship is nullified (will contain nothing). Consider 
the following code:

SelectQuery<ProductLink> q = SelectQuery.query( ProductLink.class );
q.addPrefetch( ProductLink.PRODUCT_KEY ); // <---- This line is the culprit

List<ProductLink> links = oc().select( q );

for( ProductLink link : links ) {
        System.out.println( link.product() );
}

Without the prefetch, the “product” relationship is properly populated for each 
“ProductLink” object, but if I include the prefetch, the relationship is always 
null.

Any ideas?

Cheers,
- hugi

Reply via email to