THE CORE OF DBACCESS

object

The DBObject class is the centre of the ORM.  It contains all the properties and methods that are required to ensure that an object is always persistable and atomic.

There are a few rules for the objects which are worth noting below:

 

  • All DBObject’s have a property called Id, and this is the primary key.  If you wish to have your own primary key then you will need to add this column to your table as a property such as personId and maintain it yourself.  DBAccess will always have and use the Id column, but you may choose to ignore it for your purposes.  You can implement the Id column as an NSString* property in your class if you wish to use an alphanumeric primary key column, but if you commit an object without setting it’s value, DBAccess will automatically generate a GUID and use this.  This is necessary to ensure all objects can be persisted, retrieved and removed without fault.
  • All properties must start with a lowercase letter, we will be working hard to address this issue in the future, but at the moment it is a requirement dues to the automatic creation of the get/set methods.
  • There is a DBQuery method which will return a query object that is specific only to that class.  You cannot use it to query other classes unless the other classes are used within a subquery which is standard SQLite syntax.
  • There is a joinedData dictionary, if this is nil then there were no matches to a specified join request.
  • All properties that you wish to be persisted need to be implemented using @dynamic.