api initial commit of odds and ends, not much structure yet. 1 year ago
example initial commit of odds and ends, not much structure yet. 1 year ago
parent initial commit of odds and ends, not much structure yet. 1 year ago
processor initial commit of odds and ends, not much structure yet. 1 year ago
.gitignore initial commit of odds and ends, not much structure yet. 1 year ago
README.md initial commit of odds and ends, not much structure yet. 1 year ago
pom.xml initial commit of odds and ends, not much structure yet. 1 year ago
README.md

Object Query Mapping

So this is another one of Kimee's crazy Ideas. This one is based around the idea of Object Relation Mapping (ORM), or the transformation of Relational Database tables to Object-Oriented classes. The problem I have with this is that transforming an object to a table or a table to an object is not a direct translation, and that libraries, such as Hibernate, which attempt to do this are typically fairly cumbersome to use.

I think this has largely arisen from the Model View Controller pattern. In the MVC pattern, the model is often seen as the database at a very high level. However, in practice, the database is not the model, the database mappings are the true model, and the database is simply the tool that persists the model. In practice with ORM frameworks, the day to day model is actually the persistence objects. The side effect of this is that the framework is put in a place where it is doing its best to translate objects to table relations and back, which is almost always an imperfect translation, while developers are oblivious to the imperfection.

In my mind, there are ultimately two solutions to this issue, and I would like to tackle the less popular of them. The first solution, which seems to be taking off fairly quickly, but which has its own issues, is to use an object database such as MongDB or Apache Cassandra. The second is to shift the day to day usage of the model back into the actual database. To do that, one would have to design a system which forces the user to think of the database as the model.

To that end, I've come up with Object Query Mapping. Instead of mapping the database to objects, or objects to the database, mapping a single query to an object should increase a developers awareness of the database as the model. I'm planning to design and build a small framework to do the heavy-lifting of converting a query to an object, while still giving the programmer direct control of the query.

This goal will be carried out using a set of annotations. The first annotation, @SqlParameter, will inject a SQL Parameter into the PreparedStatement. When the statement is executed, the ResultSet will be injected into an object annotated by @SqlResult. The Attributes of an @SqlResult should be annotated with@SqlColumn` to indicate which columns are mapped to which attributes.