Question

I have two persistent JDO classes. One class contains a List of the other. The comprising class is exposed using cloud endpoints. But due to lazy loading the api explorer shows me a List with empty objects in it.

I tried to add the List to the defaultFetchGroup, but I got the following Error:

The datastore does not support joins and therefore cannot honor requests to place related objects in the default fetch group. The field will be fetched lazily on first access.

So in the Cloud Endpoint get Method I need to iterate over the list. But this does not seem to be the right way. Any recommendations?

Was it helpful?

Solution

This may not seem to be the "right way" but the datastore you've chosen to use doesn't allow fetching of such things in a single call. Consequently you have to access the field. Obviously Google, when writing their plugin (which is what is doing the fetching, not DataNucleus), could have written it to do this separate access behind the scenes ... but they didn't, so access the field before returning the objects. Their plugin is open source too, so you could update it to provide that behind the scenes fetching if you wanted https://code.google.com/p/datanucleus-appengine/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top