objectify

Cannot resolve symbol 'MyApi'

此生再无相见时 提交于 2019-12-24 04:06:09
问题 MyApi was perfectly fine before. I added Objectify to the dependencies, along with some endpoints, and all of a sudden it says that MyApi isn't a thing! Here's where I call it: import android.content.Context; import android.os.AsyncTask; import android.util.Pair; import android.widget.Toast; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.extensions.android.json.AndroidJsonFactory; import com.google.api.client.googleapis.services

Got “DatastoreException: Request is missing required authentication credential” if using Objectify 6.0 and <url-stream-handler> at the same time

允我心安 提交于 2019-12-24 03:53:33
问题 On an App Engine application, deployed on standard environment with java 8 activated, I get the exception below if I use both Objectify 6.0 AND the tag <url-stream-handler>urlfetch</url-stream-handler> in the appengine-web.xml file. com.google.cloud.datastore.DatastoreException: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

Got “DatastoreException: Request is missing required authentication credential” if using Objectify 6.0 and <url-stream-handler> at the same time

此生再无相见时 提交于 2019-12-24 03:53:11
问题 On an App Engine application, deployed on standard environment with java 8 activated, I get the exception below if I use both Objectify 6.0 AND the tag <url-stream-handler>urlfetch</url-stream-handler> in the appengine-web.xml file. com.google.cloud.datastore.DatastoreException: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

Objectify: Filter by Ref (or Key) of a Certain Kind

北城余情 提交于 2019-12-23 20:24:06
问题 Say I have these classes: @Entity class MyEntity { @Id String id; @Index Ref<?> ref; } @Entity class Kind2 { ... } Can I query for all MyEntitiy objects where ref refers to any instance of Kind2 ? If so, how? 回答1: Moshe's answer is really the right one. However, you can technically hack something that works by performing inequality queries on the key. Ie, >= KEY('Kind2', 0) and <= KEY('Kind2', MAX_LONG) . This gets significantly more complicated if your entities have parents. I wouldn't

Unable to get saved entity using objectify

一世执手 提交于 2019-12-23 06:41:35
问题 I am unable to get my saved entity reliably using Objectify. It looks like the cache is getting corrupted. The strange thing is - I can see the saved entity correctly though admin console datastore viewer. Also I wrote a small program to view the entity using RemoteApi and I can see the saved value correctly. When I query the entity successively using a servlet or a cloud endpoint rest api - my successive queries are giving different results, and it looks like something in the datastore/cache

How much quota does an appengine datastore Query cost?

坚强是说给别人听的谎言 提交于 2019-12-23 03:19:15
问题 In the appengine Billing and Budgeting Resources page, it says that the cost of a "Query" maps to "1 read + 1 small per entity retrieved", whereas a "Query (keys only)" maps to "1 read + 1 small per key retrieved". This seems like a typo to me. It would seem that a Query would still need to perform a full "get" operation on each entity returned. Is this assumption incorrect? I would have expected the cost of a "Query" to be "1 read + 1 read per entity retrieved". 回答1: This definitely looks

Google Cloud Endpoints doesn't know about the Work class from Objectify 4 Transaction, causing ClassNotFoundException

时光总嘲笑我的痴心妄想 提交于 2019-12-23 02:59:13
问题 I created a very simple Objectify/Endpoints class. import static mypackage.OfyService.ofy; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiMethod; import com.googlecode.objectify.Work; @Api(name = "testapi", version = "1") public class TestEndpoint { @ApiMethod(name = "test.insert") public TestEntity insert(final TestEntity test) { test.setName("test"); return ofy().transact(new Work<TestEntity>() { public TestEntity run() { ofy().save().entities(test)

Objectify query filters like “name contains”

本小妞迷上赌 提交于 2019-12-23 02:31:18
问题 With Google App Engine using Objectify to query the datastore, I would like to use a query like objectifyService.query(Entity.class).filter("name contains", a); which would return a list with all the entities containing the 'a' caracter in their names. However the contains operator doesn't exist. Is there a simple way to do that? 回答1: You can work up a simplified equivalent of the fulltext search service by breaking down your name field into the pieces you wish to search by and storing them

Datastore Query returns null

前提是你 提交于 2019-12-22 11:06:22
问题 I am trying to retrieve a sorted list of the players scores from a datastore Entity of type"User" After executing: List<User> entities = ofy().load().type(User.class).order("-score").list(); Knowing that I indexed the "score" attribute. Here is the "User.class" @Id String userName; String password; @Index int score; The entities seem to be null and i can't get the entities details.What am I missing??? I am still working on that I managed to modify the method to: @Override public User display(

Google App Engine projection query returns 0 results

纵饮孤独 提交于 2019-12-22 09:55:53
问题 I am trying to perform a projection query in order to fetch several properties from each entity in my datastore of over ten thousand entities. I have read and followed the documentation, but my query is not returning any results. I've even simplified my projection down to only projecting a single property, the entity's ID field, but still get 0 results. Here is my simplified code: Query q = new Query("MyEntity"); q.addProjection(new PropertyProjection("entityId", Long.class));