Can you post the generated SQL by any chance? Also is there anything special about the relationship, or is it a simple to-one ?
Andrus > On May 12, 2015, at 6:02 PM, Hugi Thordarson <h...@karlmenn.is> wrote: > > 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