Using Simple ORM Objects

Last Updated: 03/28/2018 Introduced in Version: 2.0
Typesafe vs. non typesafe ORM accessors
 
There are two classes that represent access to the ORM storage
  • ORM<T>
  • DynamicORM
 
The difference between these classes is the generic one adds a number of typesafe methods.  Below is an example of both of these.
 
DynamicORM
 
ORM<T>

 

For the sake of this article, we will be using ORM<T> for examples.

Fetching an object by ID

 

Fetching an object with where conditions

Storing an object
Storing a bunch of objects
 
A list of can be stored using the ‘store’ method on ORM.

A much more efficient (using batch insert mechanism in DB) is also available. 

 Saving only certain fields on an object

 

The extra parameters are:

  • Store relationships
  • Process before and after save methods
  • Fields to save
 
Seeing if entity exists
Getting count of entities

 

Additional Resources