I am recently looking for a solution to this problem. It seems to be an old post but, never seemed to get resolved. With Spring.net and other IoC methods, you should be able to have the one interface, one class, one table.
For instance, I have ClassA that uses a property (or component) of IClassB. When I create my mapping, I want to specfy the IClassB in the mapping, not the concrete class. I can hear the questions now, but why etc.
My interfaces could be in one or more DLLs and concrete classes in another. Also my persistence layer could be busted up into multiple DLLs based on components. I want one of my persistence DLLs to map to the interfaces rather than the concrete classes because if (or when) I change my concrete classes I don't want persistence component B to break because of a namespace or assembly name change.
I've tried a couple of work arounds using joined-subclass but get the error regarding can not map to the same table as the parent, or something to that effect. Can't use subclass because there is no discriminator.
Code:
ClassA{
IClassB obj;
public IClassB Obj{
get{return obj;}
set{obj = value;}
}
}
<class name="ClassA">
...
<many-to-one name="Obj"
class="IClassB" />
</class>
So I want to map to the interface, not the concrete class. So to do this, I need to map the interface, but I want the concrete class mapped to the same table.