I have 200+ schemas that share a common table structure. I don't have to perform cross-schema queries such that like objects from different schemas are returned as a single result set. However, I would like objects in different schemas to be represented by the same class. I need all of the objects accessible from a single session rather than having 200+ session factories. What is a good strategy for doing this?
One class (and mapping) per schema using table per concrete class inheritance? I can specify the table name as "<schema>:<table>" and have it query against the appropriate schema. All of the classes could inherit from same interface to give me polymorphic behavior on my service layer.
One mapping file per schema per class? (can I even have multiple mappings point to the same class? prob not.)
Some mechanism to switch the schema for a class mapping at runtime that doesn't breakdown with concurrency usage? (Or switch the table mapping for the class at runtime. same difference.)
Map persistence to stored procedures to do the switching for me?
Other?
Thanks,
Jay
|