Closed GoogleCodeExporter closed 9 years ago
Correction: As I tested it without transactionless, it seems to have nothing to
do with that - the reslult was the same
Original comment by jan.g...@gmail.com
on 10 May 2014 at 7:15
Correction 2: actually called from a push queue! (that is dealing with another
pull queue inside:)
To deal with the problem, I'm probably supposed to add task to the queue with
the appropriate namespace set on the maanger.
This is not objecctify issue/
Original comment by jan.g...@gmail.com
on 10 May 2014 at 7:21
After a final experinment, this is objectify issue after all. I changed code to:
NamespaceUtils.swap(taskTag.getNamespace());
try {
logger.info("Namespace before: " + NamespaceManager.get());
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
datastore.put(new Entity("Employee", "asalieri"));
result = ofy.get().save().entities(entities).now(); // after they fix the bug: ofy().get().transactionless().save()....
logger.info("Namespace after: " + NamespaceManager.get());
} finally {
NamespaceUtils.restore();
}
//ofy.get() is just:
@Override
public Objectify get() {
return ObjectifyService.ofy();
}
and native datastore entity is saved in the correct namespace, while saving via
objectify will save to a default namespace.
Original comment by jan.g...@gmail.com
on 11 May 2014 at 1:07
I can't really tell from your code what is going on.
Whatever is going on with namespaces, can't have anything to do with Objectify.
Objectify has no knowledge of namespaces and has no code to manipulate them.
GAE stores the "current" namespace as a thread local (actually as an attribute
in the thread local apiproxy environment). GAE imbues keys with a namespace
inside the low level api when the key is created. Objectify isn't involved.
Basically, if namespaces aren't working as you expect, the problem is either a
bug in your code or a bug in the low level API.
If you'd like to open up a discussion on the objectify google group, someone
might be able to help you. I would start by trying to distill the problem to a
better-isolated test case.
Original comment by lhori...@gmail.com
on 11 May 2014 at 6:01
Yes. Indeed. This has nothing to do with objectify:) The issue on my side was
in that the key of the entity was created in default namespace. Thus setting
namespaces had no effect. Thanks for the prompt response.
Original comment by jan.g...@gmail.com
on 11 May 2014 at 8:41
Original issue reported on code.google.com by
jan.g...@gmail.com
on 10 May 2014 at 6:53