You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
Objectify is a Java data access API specifically designed for the Google App Engine datastore. Its goals are to:
Be easy to learn and understand.
Support all native datastore features in an intuitive, human-friendly way.
Model sophisticated, strongly-typed, polymorphic data structures.
Enable modular, EJB-like transactional logic.
Increase performance and decrease cost through smart, transaction-aware caching.
Allow major schema migrations "in-place" with zero downtime.
Seamlessly coexist with other datastore tools: the Java Low-Level API, JDO/JPA, Twig, Go, Python DB and NDB.
Objectify provides a level of abstraction that is high enough to be convenient, but low enough not to obscure the key/value nature of the datastore. It is intended to be a Goldilocks API - not too low level, not too high level, just right.
Overview
If you are new to Google App Engine, start with Concepts
This is a quick tour of what using Objectify looks like, intended to give you a taste of the framework. Full explanations can be found later in the documentation.
importstaticcom.googlecode.objectify.ObjectifyService.ofy;
Carporsche = newCar("2FAST", RED);
ofy().save().entity(porsche).now(); // async without the now()assertporsche.id != null; // id was autogenerated// Get it backResult<Car> result = ofy().load().key(Key.create(Car.class, porsche.id)); // Result is asyncCarfetched1 = result.now(); // Materialize the async value// More likely this is what you will typeCarfetched2 = ofy().load().type(Car.class).id(porsche.id).now();
// Or you can issue a queryCarfetched3 = ofy().load().type(Car.class).filter("license", "2FAST").first().now();
// Change some data and write itporsche.color = BLUE;
ofy().save().entity(porsche).now(); // async without the now()// Delete itofy().delete().entity(porsche).now(); // async without the now()