Questions tagged [objectify]

Objectify is a 3rd party Java data access API specifically designed for Google Cloud Datastore in the App Engine Standard runtime. It occupies a "middle ground"; easier to use and more transparent than JDO or JPA, but significantly more convenient than the Low-Level API provided for Cloud Datastore.

Objectify is a 3rd party Java data access API specifically designed for Google Cloud Datastore in the App Engine Standard runtime. It occupies a "middle ground"; easier to use and more transparent than JDO or JPA, but significantly more convenient than the Low-Level API provided for Cloud Datastore.

It also integrates with the App Engine memcache and taskqueue APIs to simplify common patterns of working with Cloud Datastore.

The Cloud Datastore low-level Java API for App Engine Standard is simple and elegant, neatly reducing your data operations to four simple methods: get, put, delete, and query. However, it is not designed to be used by the average developer:

  • DatastoreService persists GAE-specific Entity objects rather than normal POJO classes.
  • DatastoreService Keys are untyped and error-prone.
  • DatastoreService has a machine-friendly but not human-friendly query interface.
  • DatastoreService has an unnecessarily complicated transaction API.

Objectify provides a convenient layer which addresses these issues, yet preserves the elegance of get, put, delete, and query.

1145 questions
8
votes
1 answer

Objectify/AppEngine: best way to count # of objects returned by a query?

What would be the best (i.e. most efficient) way of counting the number of objects returned by a query, w/o actually loading them, using Objectify on AppEngine? I'm guessing the best is to fetch all the keys and counting the result: public int…
Laurent Grégoire
  • 4,006
  • 29
  • 52
8
votes
1 answer

Objects not saving using Objectify and GAE

I'm trying to save an object and verify that it is saved right after, and it doesn't seem to be working. Here is my object import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Id; @Entity public class…
b-ryce
  • 5,752
  • 7
  • 49
  • 79
8
votes
2 answers

Only Ancestor queries are allowed inside transactions, how to deal with it?

I need to do a query inside a Transaction, however I don't know the Entity @Id, what I have is a value of a field, like a username but not the ID, So in other words, I can't create a Key to do the query. How can I do a query to get an Entity inside…
quarks
  • 33,478
  • 73
  • 290
  • 513
7
votes
2 answers

objectify query filter by list in entity contains search parameter

in an app i have an entity that contains a list of other entities (let's say an event holding a list of assigned employees) using objectify - i need to find all the events a particular employee is assigned to. is there a basic way to filter a query…
sean christe
  • 879
  • 2
  • 7
  • 24
7
votes
1 answer

Objectify Relationships: One-to-Many, Can I do this efficiently?

I'm fairly new to Objectify, and I had a quick question for the best way to do something: Lets say I have an application that allows people to send and receive messages (think e-mail for simplicity). When my app loads, I don't want to load every…
spierce7
  • 14,797
  • 13
  • 65
  • 106
7
votes
3 answers

Get an Objectify Entity's Key

Dummy question. I create my POJO Objectify entity (for example, "Category") and persist it. Then I retrieve it via a query. I want to use it in a one-to-may relationship e.g. want to set my category to one or more "Products". I will have this in my…
Fabio B.
  • 9,138
  • 25
  • 105
  • 177
7
votes
2 answers

Stripping python namespace attributes from an lxml.objectify.ObjectifiedElement

Possible Duplicate: When using lxml, can the XML be rendered without namespace attributes? How can I strip the python attributes from an lxml.objectify.ObjectifiedElement? Example: In [1]: from lxml import etree, objectify In [2]: foo =…
Daenyth
  • 35,856
  • 13
  • 85
  • 124
7
votes
0 answers

Java Google App Engine bulk loader download warning “No descending index on __key__, performing serial download”

Possible Duplicate: App engine bulk loader download warning "No descending index on key, performing serial download" My post is very similar to: App engine bulk loader download warning "No descending index on __key__, performing serial…
Stewie
  • 185
  • 11
7
votes
1 answer

App engine consistent latency spikes under low load

I've noticed periodic, but consistent latency spikes from my app running on app engine. At first I thought the network may be slow but app stats confirmed that not to be the case. I've been able to reproduce the latency spikes using older and newer…
7
votes
2 answers

How do you implement cascading delete in Objectify?

I have the following heriacy. GrandParent --> Parent --> Child Parent and Child use @Parent Ref and @Parent Ref to create there parent relationship. I am trying to come of with a good way to do a cascading delete for…
Marc M.
  • 3,631
  • 4
  • 32
  • 53
7
votes
2 answers

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

boolean r = ofy().transact(new Work() { @Override public Boolean run() { Visit visit = ofy().load().type(Visit.class) .filter(Visit.USER_ID, userID) …
RCB
  • 2,253
  • 2
  • 25
  • 49
6
votes
2 answers

Spring transactions with Objectify and Appengine

I am using appengine with Objectify to access my datasource. I use Spring for my business layer. In order to play with data I use the objectify-appengine-spring factory. I would like to use annotation based local transactions. Do you know about an…
6
votes
2 answers

Objectify context not started / ObjectifyFilter missing

App Engine is (all of a sudden) telling me that I have Objectify set up incorrectly. It was working before and I do have the Objectify Filter in my web.xml. Here's the full stacktrace from my logs: javax.servlet.ServletContext log:…
6
votes
3 answers

Why .now()? (Objectify)

Why would I ever want to load an Objectify entity asynchronously? And what does asynchronous loading actually mean? According to Objectify documentation about loading, the following way of loading an Entity is asynchronous: // Simple key fetch,…
Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113
6
votes
1 answer

How can I load all entities of a given kind from Cloud Datastore with Objectify?

I have about a hundred objects stored in the Cloud Datastore with Kind = Animal. I would like to get all Animals from the database via the low level API or with Objectify.
user2836797
1
2
3
76 77