Utilising Objectify Outside of Context - objectify/objectify GitHub Wiki
Utilising Objectify outside of the context is not possible as the ObjectifyFilter
cannot hit, you can use the work method instead
You will get the following error:
java.lang.IllegalStateException: You have not started an Objectify context. You are probably missing the ObjectifyFilter. If you are not running in the context of an http request, see the ObjectifyService.run() method.
The ObjectifyService.run method is used like:
Car result = ObjectifyService.run(new Work<Car>() {
@Override
public Car run() {
Car result = ofy().load().type(Car.class).filter("carid", carID).first().now();
return result;
}
});