Manipulating and persisting objects

Creating and manipulating objects New objects can be instantiated with the constructor functions returned from persistence.define calls. Optionally, an object with initial property values can be passed as well, or the properties may be set later.: In server-environments, a Session object must be passed to entity constructors, as follows: Many-to-one relationships are accessed using their specified name, e.g.: One-to-many …

Manipulating and persisting objects Read More »

Schema definition

A data model is declared using persistence.define. The following two definitions define a Task and Category entity with a few simple properties. The property types are based on SQLite types, specifically supported types are (but any SQLite type is supported): TEXT: for textual data INT: for numeric values BOOL: for boolean values (true or false) DATE: for date/time value (with precision of 1 …

Schema definition Read More »

AppEngine Datastore Setup

Download and install the Google AppEngine Java SDK Download and RingoJS Create a new RingoJS web app with AppEngines support:ringo-admin create -a yourappname copy persistence.js and persistence.store.appengine.js into the application’s WEB-INF/modules directory. Copy appengine-api-*.jar from your AppEngine Java SDK (in the $APPENGINESDK/lib/user/ directory) into WEB-INF/lib. Edit WEB-INF/app/actions.js as follows:var {Response} = require(‘ringo/webapp/response’); var persistence = require(‘./persistence’).persistence; var persistenceStore = require(‘./persistence.store.appengine’); persistenceStore.config(persistence); var User = persistence.define(“User”, { username: “TEXT”, …

AppEngine Datastore Setup Read More »

Setting up persistence.js using

Installing persistence.js on node is easy using npm: Alternatively, you can clone the repository manually: If installed manually, you also need to install node-mysql, the MySQL driver that the persistence store depends on. Setup You need to require two modules, the persistence.js library itself and the store module. Alternatively, if you cloned persistence.js using git, use a relative path to the modules instead, e.g.: Then, …

Setting up persistence.js using Read More »

Setting up persistence.js in the browser

Browser support Modern webkit browsers (Google Chrome and Safari) Firefox (through Google Gears or in-memory database and localStorage fallback) Opera Android browser (tested on 1.6 and 2.x) iPhone browser (iPhone OS 3+) Palm WebOS (tested on 1.4.0) Setup To use persistence.js you need to clone the git repository: To use it you need to copy lib/persistence.js to your web …

Setting up persistence.js in the browser Read More »