Jpalite

Lightweight Java Persistence Package

Jpalite is targeted for applications running on resource-constrained platforms such as Android. It extends the OrmLite lightweight Java persistence package to implement a lightweight version of the v2.0 JPA API . As Jpalite is only a thin layer over Ormlite, it is essentially as lightweight as Ormlite itself. Here are some of the many ways Jpalite enhances Ormlite:

  • Follows a standard API widely used in Java development shops
  • Persistence units allow different modules to independently share a single database
  • A configuration file in XML format identifies persistence units and entity classes
  • Named queries provide a convenient way to perform high-level persistence operations
  • Transaction management without boiler plate code

Jpalite is portable to any of the many databases supported by OrmLite - refer Supported Databases.

To learn more about Jpalite, refer to Introduction to Lightweight JPA .

Programming with Jpalite

The code snippet below comes from the Many to Many Sample and shows the begiining of a persistence task which demonstrates an many-to-many association between two tables. You can see the task has a single parameter of type EntityManagerLite. This interface is pivotal to programming with Jpalite.

An entity is a plain Java object which represents a table stored in a database. Every instance of an entity represents a row in the table. The EntityManagerLite interface outlines Jpalite's persistence capabilities which includes entity creation, updates deletions and queries. This interface also provides access to the underlying OrmLite framework if needed as a back stop.

Persistence task