Hello,
I have a problem with an abstact class with 2 derived classes. NHibernate tries to instanciate my abstract class, even if there are records in the joined tables corresponding to the subclasses.
If I remove the abstract, the mapping works and only objects correponding to derived classes are returned.
The mapping file looks like this :
...
<class name="ch.VibroMeter.Xms.Configuration.Xmc.XmcChannel" table="XmcChannels">
<composite-id>
<key-property name="Id" column="Id" type="Int64" />
<key-property name="Revision" column="Revision" type="Int64"/>
</composite-id>
...
<joined-subclass name="ch.VibroMeter.Xms.Configuration.Xmc.XmcSingleDynamicProcessingChannel"
table="XmcSingleDynamicProcessingChannels" lazy="false">
<key>
<column name="Id" />
<column name="Revision"/>
</key>
</joined-subclass>
<joined-subclass name="ch.VibroMeter.Xms.Configuration.Xmc.XmcSpeedProcessingChannel"
table="XmcSpeedProcessingChannels" lazy="false">
<key>
<column name="Id" />
<column name="Revision"/>
</key>
</joined-subclass>
</class>
...
The query comes from another class with a many-to-many association to the abstract class :
<set name="XmcChannelsNH" table="XmcChannelsMachinesRelations">
<key>
<column name="MachineId" />
<column name="MachineRevision" />
</key>
<many-to-many class="ch.VibroMeter.Xms.Configuration.Xmc.XmcChannel" lazy="false">
<column name="XmcChannelId" />
<column name="XmcChannelRevision" />
</many-to-many>
</set>
Thanks in advance...
|