FAQ Database Discussion Community


Getting timestamp from Objecify entity?

objectify,google-datastore,optimistic-locking,google-cloud-datastore
Is it possible to obtain the timestamp that is used for optimistic concurrency control from an Objectify entity (or a lower-level part of the Google Datastore infrastructure) and if so, how?

ObjectifyService.beginTransaction not available (missing) in Objectify5 as documented

objectify
According to the documentation here: https://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#Relationships To perform transaciton, you need Objectify ofy = ObjectifyService.beginTransaction(); However, I just downloaded Objectify5 and ObjectifyService does not have beginTransaction. Am I missing something or the documentation is out of date?...

GAE Java Objectify Can't find a parent

java,google-app-engine,objectify
I'm starting in Java/Objectify and i'm encountering a problem. (A colleague just post my question in french before because he didn't know the rules and I didn't have an account.) To explain, I have 3 classes what are working as this: A Server have a Site parent what have a...

503 Error ObjectifyService NoClassDefFoundError

java,google-app-engine,maven,gae-datastore,objectify
I am having issues with GAE in the api explorer.I am trying to use objectify to save to a datastore but I am getting this error: { "error": { "message": "java.lang.NoClassDefFoundError: Could not initialize class Project.service.OfyService", "code": 503, "errors": [ { "domain": "global", "reason": "backendError", "message": "java.lang.NoClassDefFoundError: Could not initialize...

Datastore & Memcache consistency - Google App Engine & Objectify

java,google-app-engine,gae-datastore,objectify,consistency
I'm having a pretty tough problem ensuring consistency in the datastore. We're trying to do a sync job to BigQuery every 1 minute (cron) and are relying on the Datastore to store a timestamp for when the previous sync was completed. We are still seeing eventual consistency when the object...

Objectify: Handle race condition to prevent duplicate account creation

google-app-engine,gae-datastore,objectify
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...

Objectify transaction rollback not happening

gae-datastore,objectify,google-datastore
When I intentionally throw an exception within an Objectify transaction, my transaction is not being rolled back. What am I doing wrong? @Inject Dao dao ... public void testTransaction(){ dao.transact(new VoidWork() { @Override public void vrun() { Key aclKey= dao.save().entity(acl).now(); //expecting this to be rolled back //throw exception if(true) throw...

503 Service Unavailable for google endpoints

java,google-app-engine,google-cloud-endpoints,objectify
I am using endpoints to try and create a patient entity for my web application. i keep getting the following error code when i try to run the API. 503 Service Unavailable - Show headers - { "error": { "errors": [ { "domain": "global", "reason": "backendError", "message": "java.lang.IllegalStateException: You have...

Objectify: Filter by an attribute of collection entries?

google-app-engine,collections,objectify
I'm using Objectify on Google's AppEngine. I have the following Entity-Model: @Entity public class ChallengeEntity { @Id private Long id; @Index public List<ChallengeParticipant> participants; } The Participant (not an entity... should it be one?) public class ChallengeParticipant { @Load public Ref<UserEntity> user; // ... participant-specific attributes } And the User-Entity:...

Storing the value with the Ref, as long as it's not in the datastore

google-app-engine,gae-datastore,objectify
I'm have a List<Ref<Entity>>. I add new entries to the list like this: entities.add(Ref.create(new_entry)); modified.add(new_entry); When I store the entity that contains the list, I store the list itself and all the entities that are in the modified list. This works fine. The problem is, that I have to work...

Objective-C client for Google Cloud Datastore API?

ios,google-app-engine,google-cloud-endpoints,objectify,google-cloud-datastore
In the past I have succeeded in accessing a Google App Engine Datastore from a Google App Engine (GAE) application with Objectify and generating an Objective-C client for this application (including its Objectify Java annotations) with Google Cloud Endpoints. This gave me a client for accessing this datastore from iOS...

Objectify list consistency in one entity

google-app-engine,gae-datastore,objectify
I try to make a chat solution on App Engine for my android app. A decided that instead of save all messages send to a topic in a separated entity like ChatMessage or something like this, I can save them in a List of Strings inside the Topic entity, like...

Objectify - should I create an entity super class?

java,google-app-engine,objectify
Is there any reason why shouldn't all my entities be subclasses of one generic ModelEntity object? @Entity public class ModelEntity { @Id Long id; } @Subclass public class User extends ModelEntity { @Index String username; } The advantages are clear: there is code common to all entities (like id, date,...

Does Objectify support Joda-Time Interval class?

java,google-app-engine,jodatime,objectify,google-cloud-datastore
We use Objectify 5 to access Google Cloud Datastore. We have an entity with a property of type Interval from Joda-Time library. When we try to save such an entity, we get the error below. It seems that Objectify has problem with Chronology and its subclasses. com.googlecode.objectify.SaveException: Error saving MyEntity(null):...

Java datastore write performance: Objectify vs. JPA

google-app-engine,jpa,gae-datastore,objectify
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...

How to delete entity by Id from data-store in AppEngine?

google-app-engine,gae-datastore,objectify,objectify-delete
I created an API to delete an Entity by its key however I'm gettin Http 204 and Entity does not delete from data-store. This is my API, @ApiMethod(name = "deleteContact", path = "contact", httpMethod = ApiMethod.HttpMethod.DELETE) public void deleteContact(final @Named("id") long contactId) { ofy().delete().type(Contact.class).id(contactId).now(); } and my Contact class is...

Is there a limit on the number of entities you can query from the GAE datastore?

google-app-engine,gae-datastore,objectify
My GCM Endpoint is derived from the code at /github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints/root/src/main. Each Android client device registers with the endpoint. A message can be sent to the first 10 registered devices using this code: @Api(name = "messaging", version = "v1", namespace = @ApiNamespace(ownerDomain = "${endpointOwnerDomain}", ownerName = "${endpointOwnerDomain}", packagePath="${endpointPackagePath}")) public class MessagingEndpoint...

Objectify - scavenging sessions

java,session,session-timeout,objectify,servlet-listeners
My original HttpSessionListener code: public class SessionListener implements HttpSessionListener { @Override public void sessionDestroyed(HttpSessionEvent event) { final Object user = event.getSession().getAttribute("user"); if (user != null && user insteaceof User) { UserUtils.deleteUser((User) user); } } } and my web.xml <filter> <filter-name>ObjectifyFilter</filter-name> <filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class> </filter> <filter-mapping>...

persisting relationships in datastore - app engine and objectify

java,google-app-engine,gae-datastore,objectify
my app is using objectify. i'm really new to NoSql . i have a data model like this. pay no attention to lack of getters and setters, lack of builder pattern, etc. is just an example. as you can see, ReallyWeirdCar is the root of a quite deep object graph....

Polymorphism with Objectify 5

java,google-app-engine,objectify
I have this classes: @Entity(name = "Post") public abstract class PostRecord { @Id private Long id; private String field1; } @Subclass(name = "Bulletin") public class BulletinRecord extends PostRecord { private String field2; } @Subclass(name = "Session") public class SessionRecord extends PostRecord { private String field3; } How i do to...

Java Web App over App Engine error access

java,google-app-engine,maven,objectify
I am developing a Java Web App using Google App Engine, the app use Maven, JSF and Objectify and works fine in devserver but in production give the following error: com.sun.faces.config.ConfigureListener contextInitialized: Critical error during deployment: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:375) at java.security.AccessController.checkPermission(AccessController.java:565) at...

[GAE - Objectify]: LinkedHashMap doesn't respect key's order

google-app-engine,objectify,linkedhashmap
I'm working with Objectify to access DataStore in a Google App Engine application. I have 2 Entities: @Entity public class Client { @Id String id; } @Entity public class Queue { @Index @Id String name; @Load LinkedHashMap<String,Ref<Client>> clientsInQueue; } In a transaction, i do something like this: Client newClient =...

Generate unique Long Id on App Engine

google-app-engine,objectify,google-datastore
I've three possible ways user can sign in into our service: login and password Google+ Facebook I want to keep all those user id's in one entity. To avoid id collisions between e.g. Google and Facebook a prefix will be added to id (g- and f- respectively). Currently for users...

App Engine Objectify not creating index on base class field

google-app-engine,objectify
Let's say I have a simple Entity hierarchy setup where a base (abstract) class has common fields: @Entity public abstract class Base { @Id Long mId; @Index Long mVal; } Now I have a subclass (both in Java and in Objectify): @Subclass(index=true) public class Concrete extends Base { @Index mOtherVal;...

How properly store and query an Objectify Entity with ancestor()? [closed]

java,google-app-engine,objectify
What is the right way to store and query back an Objectify Entity involving a field marked with Objectify's @Parent annotation? Please provide an example using an ancestor() query.

Objectify doesn't always return results

google-app-engine,gae-datastore,objectify
I am using Objectify to store data on Google App Engine's datastore. I have been trying to implement a one-to-many relationship between two classes, but by storing a list of parameterised keys. The method below works perfectly some of the time, but returns an empty array other times - does...

java.lang.OutOfMemoryError from large Map marked with @Stringify

java,google-app-engine,objectify
How can I resolve a "java.lang.OutOfMemoryError: Java heap space" for the Map property timeseries that's apparently too big to retrieve from the Google App Engine datastore? The error occurs when I try to read the entity containing the large map from the datastore using an Objectify load() operation. Here's the...

Store and Retrieve items in an ArrayList using GAE Datastore and Objectify

java,jsp,google-app-engine,objectify
I am trying to write a query that will allow me to retrieve a datastore Entity's ArrayList so that I can display it on a JSP. I am able to add the Entity to the datastore successfully, and I can see in the dev console that the ArrayList is there...