Skip to content

icoloma/simpleds

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SimpleDS provides a simple persistence framework for Google AppEngine that gets as little in the way as possible. It is barely a wrapper around Datastore APIs, providing mapping between Entity and Java classes.

You can explore the details about SimpleDS at our presentation for Codemotion 2012.

There is also a demo application on GitHub.

Analytics

Features

  • Supports Guice, Spring or plain Java configuration.
  • Support for embedded classes serialized as properties or in JSON format.
  • ==, <, <=, >, <=, IN, != and left like are supported.
  • Easy transformations between Java Objects and Datastore Entities.
  • Easy support for Cursors.
  • Validations of expected ancestors
  • Transaction support
  • Level 1 and 2 Cache
  • Cacheable queries

Examples

This is a brief comparison between SimpleDS and JPA:

// JPA retrieve by key
Model m1 = entityManager.find(Model.class, key);
Model m2 = entityManager.find(Model.class, key2);

// SimpleDS retrieve by key
Model m1 = entityManager.get(key);
Map<Key, Model> l = entityManager.get(key1, key2);

// JPA persist changes
entityManager.merge(m1);
entityManager.persist(m2);

// SimpleDS persist changes
entityManager.put(m1);
entityManager.put(ImmutableList.of(m1, m2));
Model m3 = new Model();
entityManager.put(parentKey, m3);

// JPA remove
Model m1 = entityManager.find(Model.class, key);
entityManager.remove(m1);

// SimpleDS remove
entityManager.remove(ImmutableList.of(key1, key2, key3));

Queries

// JPA
Query query = entityManager.createQuery(
   "select m from Model m where m.createdAt<=?1 and m.createdBy=?"
);
query.setParameter(1, new Date());
query.setParameter(2, userKey);
return query.getResultList();

// SimpleDS
return entityManager.createQuery(Model.class)
  .lessThan("createdAt", new Date())
  .equal("createdBy", userKey)
  .asList();

// retrieve just keys
return entityManager.createQuery(Model.class)
  .keysOnly()
  .asList();

// with limits
return entityManager.createQuery(Model.class)
  .withOffset(10)
  .withLimit(100)
  .asList();

About

A simple java wrapper to use AppEngine Datastore APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages