objectify

Incremental IDs on Objectify

荒凉一梦 提交于 2019-12-08 07:24:45
问题 Since upgrading to GAE 1.8, I'm getting scattered ids when annotating with @Id in Objectify: @Id private Long id; Even though I understand the need for scattered ids in terms of avoiding hotspots on the cloud platform, is there a way in Objectify to get the old incremental ids back? Having to display a hexatridecimal value (like 1DZENH6BSOW) in the UI to avoid that massive generated 64bit id just doesn't cut it. I'm happy to have a secondary annotation @IdLegacy working in conjunction with

Java datastore write performance: Objectify vs. JPA

梦想与她 提交于 2019-12-08 07:06:26
问题 I ran two five minute long simple benchmarks against the datastore. One used the JPA implementation on top of Datanucleus provided by Google and the other used Objectify for persistence. Each request created 10 new indexed entities with the same 9 fields, each using another datatype. To avoid any effects by the network connection the benchmark returned the timespan between the start and the end of 10 writes. AVG Median 10% 90% 99% JPA 76.5 76 53 98 114 Objectify 41.1 40 39 43 57 Objectify TX

appengine-api-1.0-sdk-1.7.6.jar is not a directory

会有一股神秘感。 提交于 2019-12-08 06:40:37
问题 I just started using Maven in my projects. I converted an old project to a Maven project and at first everything worked fine. But now I have a problem. When I try to run the application (is a GWT application that uses Objectify) I get the following error: SDK location '/Users/abelbarbosa/.m2/repository/com/google/appengine/appengine-api-1.0-sdk/1.7.6/appengine-api-1.0-sdk-1.7.6.jar' is not a directory I know that it isn't a directory but i don't think it was supposed to be. I don't know how

How much quota does an appengine datastore Query cost?

北慕城南 提交于 2019-12-08 04:46:29
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". This definitely looks like a typo. cpm_usd looks like a deprecated way to measure costs, linked to the previous pricing model. With

Objectify: Handle race condition to prevent duplicate account creation

久未见 提交于 2019-12-08 03:27:57
问题 I'm using Google App Engine and Datastore with objectify. I'm trying to create an account for a user (Google user), so I need to check if that users exist, and if not, create an account for that user, but I'm facing the fact that sometimes the account is created twice if I spam the createAccount API method @ApiMethod(name = "account.google.create") public Account createGoogleAccount(final User user) throws OAuthRequestException { if (user == null) { throw new OAuthRequestException(

objectify-appengine - Embedded class - not a supported property type

夙愿已清 提交于 2019-12-08 02:27:04
问题 I am trying out the objectify(version 2.2.3) embedded classes example (wiki) on google app engine. I am getting this error: java.lang.IllegalArgumentException: one: com.mypkg.LevelOne is not a supported property type. at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue(DataTypeUtils.java:184) The code I have is the same as the one in Wiki. The section in the controller: EntityWithEmbedded ent = new EntityWithEmbedded(); ent.one = new LevelOne(); ent.one.foo = "Foo

Getting Entity Key with Objectify 4

偶尔善良 提交于 2019-12-07 11:55:05
问题 I need to do getKey() with this kind of Entity: @Entity public class Value { @Id private long id; private byte[] value; com.googlecode.objectify.Key<Value> getKey() { return com.googlecode.objectify.Key.create(Value.class, id); // When executed this line throws NullPointerException } // Code omitted } However the pattern I used before with version 3 seems to be not applicable anymore. The @Transient is replaced by @Ignore but when I annotate my getKey() function with @Ignore I get this error:

Efficient way to query all records where a field is not null in objectify

↘锁芯ラ 提交于 2019-12-07 08:10:40
问题 I want to query an indexed field efficiently to retrieve all records where the indexed field is not null (present in the index). The field to be queried contains a Ref<T> to another entity, in case this is relevant. What I could do is an inequality search, like .filter/.filterKey("fieldname >=", "a") , where a is the smallest ASCII that I want to grab. But is this efficient? Or can I do an equality search somehow, which returns all records that are present in the index? -- This is how my data

Why do I get Only ancestor queries are allowed inside transactions error

穿精又带淫゛_ 提交于 2019-12-07 06:10:41
问题 boolean r = ofy().transact(new Work<Boolean>() { @Override public Boolean run() { Visit visit = ofy().load().type(Visit.class) .filter(Visit.USER_ID, userID) .filter(Visit.VENUE_ID, venueID).first().get(); if (visit == null) return false; visit.setLastRequestDate(new Date(timestamp)); ofy().save().entity(visit).now(); return true; } }); and I get java.lang.IllegalArgumentException: Only ancestor queries are allowed inside transactions. for the line with the get() call. why? I'm only querying

objectify-appengine - Embedded class - not a supported property type

此生再无相见时 提交于 2019-12-06 12:43:09
I am trying out the objectify(version 2.2.3) embedded classes example (wiki) on google app engine. I am getting this error: java.lang.IllegalArgumentException: one: com.mypkg.LevelOne is not a supported property type. at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue(DataTypeUtils.java:184) The code I have is the same as the one in Wiki. The section in the controller: EntityWithEmbedded ent = new EntityWithEmbedded(); ent.one = new LevelOne(); ent.one.foo = "Foo Value"; ent.one.two = new LevelTwo(); ent.one.two.bar = "Bar Value"; The EntityWithEmbedded class: import