The basic idea was to try to abstract away all the SQL specific stuff from the programming model to allow for working with POJO's as easy as possible. Lets just say I got one step to bored with having to think/work/program in terms of Tables, Rows, DataSets and so on in .NET. For me that is just to low level. I want to work with proper objects (POJO's), and I want the CRUD operations related to these to be as transparent as possible. The less code I have to write the less I have to worry about.
The framework itself relies heavily on Annotations and Reflection as I am a strong believer in a self-contained representation model. Thus I should not have to configure something unnecessarily in a configuration file (XML or something similar) when the intent can be clearly specified in the class file itself.
Some basic assumptions regarding the framework
- The schema must match that of the domain model (currently working on an schema auto-generator)
- There is a one to one relationship between a table and a class name (unless otherwise specified using an Annotation)
- There is a one to one relationship between a field and a table column (unless otherwise specified using an Annotations)
- The many2one relationship must follow: (src table) id -- field_id (foreign table)
- All fields are persisted unless [Transient] is specified
- All fields are persisted unless [Transient] is specified
- Only classes with [Entity] can be persisted
- Strings are assumed for all fields unless the Id is field
- The Id field is an Int32 which cannot be null so it is assumed that a class with Id == 0 is fresh and can be inserted
- Attributes to specify the persistence option:
- Entity (speficies that this class is persistable)
- Id (speficies this field to be the primary key)
- Component (flattens the the object graph)
- Transient (do not persist this field)
- Inserts an object graph (semicascading)
- (Only persists object with the [Entity]attribute specified)
- (Only fields != null are included)
- (If the id != 0 dont bother with generating an insert)
- Update individual objects
- (No dirty checking but only fields != null are included)
- Load an object and automatically populate it with the data from the DB
- Supports QBE whereby only fields != null are included
- Load an object graph (shallow cascading)
Features that I am working on at the moment
- Collection support (requires implementation of laziness)
- Dirty checking (requires a 1 level cache, Session or something)
- Support for more databases and dialects (currently only SQLite)
- Persistence by reachability (no dynamic proxies in CF, so have to rely on a CRUD service)
I am looking for developers that are interested in contributing to this framework. If you have been using NORM in a project yourself please drop me a line or two and tell me about your experience. Any feedback is more than welcome.
More information is available from the sourceforge.net site...