Question

How can I get a list of all namespaces from the GAE datastore using objectify?

I have found the implementation by google in here:

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.Entities;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Query;


void printAllNamespaces(DatastoreService ds, PrintWriter writer) {

  Query q = new Query(Entities.NAMESPACE_METADATA_KIND);

  for (Entity e : ds.prepare(q).asIterable()) {
    // A nonzero numeric id denotes the default namespace;
    // see Namespace Queries, below
    if (e.getKey().getId() != 0) {
      writer.println("<default>");
    } else {
      writer.println(e.getKey().getName());
    }
  } 

I couldn't find any way to use it with objectify . Does anyone knows such a way? or is it not yet implemented.

Was it helpful?

Solution

That can't be done for now with the objectify framework. a discussion was opened in google groups

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