You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some code (most noticeably CursorRowMapper) requires the developer to interact directly with the SQLite database and pushes knowledge about the column names from the model into other code.
If the model includes boolean (and other?) types then the developer must also know that the field ismapped to an SQLite Integer and that 1=true, 0=false.
Instead I believe that each ColumnType should encapsulate this knowledge so that each ColumnType understands how to map is value to the database and return it to the model layer.
Once this exists, the CursorRowMapper should no longer be required as the mapping of each field would be determined by the ColumnType annotation.
TODO: now need to column info from template/accessors :)
The text was updated successfully, but these errors were encountered:
Introduced ability for com.perfectworldprogramming.mobile.orm.AndroidSQLiteTemplate to perform domain to DB conversion based on class and column name, see com.perfectworldprogramming.mobile.orm.test.reflection.QueryParameterTest (currently on my fork until pulled)
The query mechanism using the column name still mixes DB and domain knowledge, so I'm looking at a light OQL (object query language) which allows queries to be written in the domain layer and converted to SQL for the DB
eg select * from Person where [lastName] = ? and [pets] > ?
becomes select * from Person where LAST_NAME = ? and PETS > ?
select * from Person p, Address a where p.[Person.lastName] = ? p.[Person.id] = a.[Address.person]
becomes select * from Person p, Address a where p.LAST_NAME = ? p.PERSON_ID = a.PERSON_ID
Note that this assumes that the table name is the same as the class.getSimpleType(). As shown above it is not perfect since it still assumes knowledge about the column names and the need to distinguish the different PERSON_ID references.
Some code (most noticeably CursorRowMapper) requires the developer to interact directly with the SQLite database and pushes knowledge about the column names from the model into other code.
If the model includes boolean (and other?) types then the developer must also know that the field ismapped to an SQLite Integer and that 1=true, 0=false.
Instead I believe that each ColumnType should encapsulate this knowledge so that each ColumnType understands how to map is value to the database and return it to the model layer.
Once this exists, the CursorRowMapper should no longer be required as the mapping of each field would be determined by the ColumnType annotation.
TODO: now need to column info from template/accessors :)
The text was updated successfully, but these errors were encountered: