That Object-Relational-Mapping is a difficult Problem is not news.
The usual criticisms are all valid, but what occured to me, after thinking a while about this, is that all approaches I’ve seen so far seem oriented to the object-oriented modeling, trying to map the OO-models to database relations.
What about tackling the problem from the other side? Relations can have huge benefits over object graphs, why not leverage their strengths and, instead of mapping OO to relations, just try to use OO to make dealing with relations easier and more natural in OO languages?
Relational logic is powerful and relatively easy to understand. There are just a few annoyances that should be addressed:
- Validation
- Mapping relations to forms
- Keeping track of associations
This wasn’t in any way thought through by me, it just came to my mind. Maybe there are already some solutions that go this route, maybe someone even proved this to be impractical. The approach seems worth investigating.
…as soon as I find the time :(