Use simpleds to solve the persistent layer of Google appengine

Source: Internet
Author: User

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/>

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.