Hi to all!
I have got a problem with NHibernate and Abstract classes:
I have a abstract class called "Driver"
<class name="Driver" discriminator-value="DV" lazy="false" abstract="true">
<id name="OID" column="oid">
<generator class="identity" />
<!--
<generator class="hilo"/>-->
</id>
<discriminator type="String">
<column name="class" index="idx_driver_class"/>
</discriminator>
<!-- discriminator-value="DV"<discriminator column="class"
type="string"/>-->
<property name="Name">
<column name="name" not-null="true"
unique-key="uidx_driver_name_per_site"/>
</property>
<property name="Active"/>
<!-- Do not persist, transient property: <property name="Status"/>-->
<many-to-one name="Site" class="MonitoredSite">
<column name="site_id" unique-key="uidx_driver_name_per_site"
not-null="true" />
</many-to-one>
<map name="ParametersCollection" cascade="all" inverse="false"
table="driver_parameters">
<key column="driver_id" />
<index type="String" />
<element type="String" />
</map>
<bag name="DriverDetails" inverse="false" cascade="all">
<key column="driver_id"/>
<one-to-many class="DriverDetail"/>
</bag>
</class>
My other object "DriverSimulation" should derive from this class:
[Serializable()]
[Subclass(NameType = typeof(DriverSimulation), ExtendsType =
typeof(Monitoring.Domain.Driver), Lazy = false)]
public class DriverSimulation : Monitoring.Domain.Driver
{...}
Inserting into database works fine. Whenever i want to read something out
of the database i got the following error:
*Cannot instantiate abstract class or interface*
I searched google and tried the following:
http://stackoverflow.com/questions/7502455/hibernate-instantiationexception-cannot-instantiate-abstract-class-or-interfa
http://stackoverflow.com/questions/7769803/composite-key-and-inheritance
Nothing worked.
Thanks for your help.
Best Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.