objectify

Objectify loads object behind Ref<?> even when @Load is not specified

心已入冬 提交于 2019-12-03 03:41:20
I have an account object which references a user object. @Cache @Entity public final class Account { @Id Long id; @Index private Ref<User> user; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public User getUser() { return user.get(); } public void setUser(User user) { this.user = Ref.create(user); } } I have hidden the Ref as recommended here: http://code.google.com/p/objectify-appengine/wiki/Entities - please note the Ref does not have the @Load annotation. When I call my Google Cloud Endpoint from an Android client, it looks like Objectify delivers the

When do you register classes in Objectify for GAE?

♀尐吖头ヾ 提交于 2019-12-03 01:51:13
So this might be kind of a dumb question but when do you register classes with: ObjectifyService.register( User.class ); Currently, I'm doing this in the constructor of an interface-like class that I use in my other classes to simplify usage of the Data store specifically to my application. However, I'm getting this error: Attempted to register kind 'User' twice So, I guess my question is how often and specifically when do you register classes in Objectify? Thanks! P.S. Here's my entire class: import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java

Objectify with Cloud Endpoints

心不动则不痛 提交于 2019-12-02 19:19:41
I am using appengine cloud endpoints and objectify. I have previously deployed these endpoints before and now I am updating them and it is not working with Objectify. I have moved to a new machine and running latest appengine 1.8.6. Have tried putting objectify in the classpath and that did not work. I know this can work, what am I missing?? When running endpoints.sh: Error: Parameterized type com.googlecode.objectify.Key<MyClass> not supported. UPDATE: I went back to my old computer and ran endpoints.sh on same endpoint and it worked fine. Old machine has 1.8.3. I am using objectify 3.1.

Sorting a CellTable server-side

此生再无相见时 提交于 2019-12-02 13:38:12
问题 I'm currently using a Gwt CellTable, bound to my GAE/Objectify backend via RPC calls. All right now! :-) Then I want to sort columns, so I read http://code.google.com/intl/it-IT/webtoolkit/doc/latest/DevGuideUiCellTable.html#columnSorting The Async Remote sorting sections shows very well how to get sorting into my AsyncDataProvider but... how can I retrieve the name of the column the user wants to sort? It shows this code: ColumnSortList sortList = table.getColumnSortList(); But how can I get

how to apply date filter on ancestor query

匆匆过客 提交于 2019-12-02 12:11:37
I have two entity model Student and attendance such that each attendance entity has associated student parent. Attendance model: @Entity public class Attendance { @Id Long id; @Index Date date; @Parent @Index @ApiResourceProperty(ignored = AnnotationBoolean.TRUE) Ref<Student> studentRef; public Long getId() { return id; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getWebsafeKey() { return Key.create(studentRef.getKey(), Attendance.class, id).getString(); } } Student model: @Entity public class Student { @Id Long id; @Index String

Objectify query filter by List of keys that have a parent

旧城冷巷雨未停 提交于 2019-12-02 11:52:50
I would like to create an Api method via Google App Engine (Objectify) that returns a CollectionResponse of the posts of the people that I am following, sorted by date descending. I have an Entity Post and Entity Profile both of which have Long id as their key. The Post Entity has the following property specifying it has a Parent: @Parent private Key<Profile> profileKey; The Profile Entity has the following property storing a List of id 's of the people the profile is following: // Ids of the profiles this person follows private List<Long> following = new ArrayList<>(0); I was thinking then, I

Cron Job Failure on GAE using java with automatic scaling

*爱你&永不变心* 提交于 2019-12-02 11:04:23
I am trying to use cron job for executing some work once a day. I am using automatic scaling. Using cron job i am sending emails once a day. I have 2 conditions: Whenever i set time once a day for example every day 18:00 then cron job run successfully but its only executing 3, 4 lines of CronJob implementation class. In logger I am getting only 4 lines are executing like this:- whenever i set time as every 2 minutes or every 5 minutes then cron job run successfully and cron job implementation class executed successfully means its send email successfully. Why is the first condition not sending

How to create API methods in Google App Engine that have several decedents/ancestors

白昼怎懂夜的黑 提交于 2019-12-02 08:32:03
问题 I am having trouble understanding how to structure an ancestor tree with several decedents. Suppose I have a model like this (every Entity has a Long id ): User -Post -Comment Where the Comment is the grandchild of the User . What is really annoying is to insert a Comment I need to generate the Key of the Post . And to generate the Key of the Post I also need to know the ID of the User : Key<Post> postKey = Key.create(Key.create(User.class, userId), Post.class, postId); This is a problem for

Why Email, Username, PostalCode, etc as entities in GAE Datastore

陌路散爱 提交于 2019-12-01 19:08:35
I have seen the in GAE datastore there are so many entity which at the end are Strings, at least apparently. List of GAE Java Datastore Entities I'd like to know the underneath reason for that? indexing? semantic search? Richard Watson I had the same question a couple years ago. Nick answered it here . The Java classes provide parity with Python, and in Python it's useful for the special .to_xml() behaviour. It's possible that when GAE gets proper GEO queries the GeoPt might become useful but otherwise you can ignore them. It's quite clear to me -- the question is what were we (Google App

How to resolve “You have not started an Objectify context” in JUnit?

99封情书 提交于 2019-12-01 16:26:32
I've got some Objectify test code running in JUnit and I'm getting this 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. at com.googlecode.objectify.ObjectifyService.ofy(ObjectifyService.java:44) at com.googlecode.objectify.impl.ref.LiveRef.<init>(LiveRef.java:31) at com.googlecode.objectify.Ref.create(Ref.java:26) at com.googlecode.objectify.Ref.create(Ref.java:32) at com.netbase.followerdownloader.repository