Use
Simpleds
Solution
Google appengine
Persistent layer
Posted
By: chszs
Posted
On:
May 05 2010
Simpleds
Is
Gae
(
Google App Engine
) Provides an extremely concise persistence framework. It is only used for data storage.
API
Encapsulates a layer, providing the entity and
Java
Ing between classes.
Gae
Provides a very powerful service function that can persist data on the cloud, but it provides
API
To process persistence is very troublesome:
· Data Storage
API
The structure of the ing style is exposed to the underlying layer;
·
JDO
And
JPA
Of
API
It is too complex to complete simple tasks, and a large number of additional checks are added for relational databases, which affects performance.
Simpleds
The latest version is
1.0 RC1
, Which provides the following functions:
· Supports Level 1 cache and level 2 cache;
· Background tasks broke through
Gae
Of
30
Second limit;
· Optimized functions:
N + 1
The secondary query is converted into two queries and combined with the cache to improve the performance;
· Available
Simpleds
Comment or
JPA
Annotation for driver configuration;
· Supports embedded classes;
· Supported'
=
','
<
','
<=
','
>
','
> =
','
In
','
! =
','
Like
'And other operators;
· Supports paging query and cursors;
· Supports transaction processing.
Example of entity processing:
// JPA Retrieve by key <br/> model M1 = entitymanager. find (model. class, key); <br/> model m2 = entitymanager. find (model. class, key2); <br/> // simpleds Retrieve by key <br/> model M1 = entitymanager. get (key); <br/> List <model> L = entitymanager. get (key1, key2); <br/> // JPA persist changes <br/> entitymanager. merge (M1); <br/> entitymanager. persist (m2); <br/> // simpleds persist changes <br/> entitymanager. put (M1); <br/> entitymanager. put (l); <br/> model m3 = new model (); <br/> entitymanager. put (parentkey, M3); <br/> // JPA remove <br/> model M1 = entitymanager. find (model. class, key); <br/> entitymanager. remove (M1); <br/> // simpleds remove <br/> entitymanager. remove (key1, key2, key3); <br/>
Query example:
// JPA <br/> query = entitymanager. createquery (<br/> "select m from model m where M. createdat <=? 1 and M. createdby =? "<Br/>); <br/> query. setparameter (1, new date (); <br/> query. setparameter (2, userkey); <br/> return query. getresultlist (); <br/> // simpleds <br/> simplequery query = new simplequery (model. class) <br/>. lessthanorequal ("createdat", new date () <br/>. equal ("createdby", userkey); <br/> return entitymanager. find (query); <br/> // retrieve just keys <br/> entitymanager. find (query. keysonly (); <br/> // with limits <br/> entitymanager. find (query. withoffset (10 ). withlimit (100); <br/>