Is it possible to map the same class to both ORM and ODM using annotations?
We are deciding what to use so we want to do some performance measurment and we also want to be able to switch the persistance mappers easily. I have already done the manager unification, now i would like to unify the classes. Now i have a copy of each class in separate namespaces for Entities and Documents which i find kind of redundant.
I read this article http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/cookbook/mapping-classes-to-orm-and-odm.html, but in the end i guess they use two different classes, each in their own namespace.
Has anybody tried this?
I've never tried but it's totally possible to put both ODM and ORM mapping on the exact same class.
The problem will maybe rely on synchronization of data between these two persistence backends and the Entity API. For example, if you have a ManyToOne association, ODM will have a different internal in memory reference than ORM. So it's possible that it will override objects you were working with.