I am working with a legacy database that uses composite keys. I created a composite identifier class, OperationId, to use as the id for my Operation class. In OperationId, I implement ISerializable and override Equals and GetHashCode. My Operation.hbm.xml class (compiled as an embedded resource) is:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="ClassTester.Operation, ClassTester" table="OPERTN_NM_REF">
<composite-id name="Id" class="ClassTester.OperationId">
<key-property name="OperationCode" column="OPERTN_CD" />
<key-property name="OperationCategory" column="OPERTN_CAT_REF_CD" />
</composite-id>
<property name="DeleteIndicator" column="DLT_IND" type="Char" length="1"/>
<property name="OperationName" column="OPERTN_NM" type="String" length="50" />
<property name="OperationMessage" column="OPERTN_MSG_TXT" type="String" length="100" />
<property name="OperationDescription" column="OPERTN_DSC_TXT" type="String" length="200" />
</class>
</hibernate-mapping>
I have verified that the OperationId class is in my assembly (ClassTester).
When I execute
cfg.AddAssembly( "ClassTester" );
--OR--
cfg.AddClass( typeof( Operation ) );
I get the following exception:
Unhandled Exception: NHibernate.MappingException: component class not found --->
System.TypeLoadException: Could not load type ClassTester.OperationId
from assembly NHibernate, Version=0.8.3.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc.
at System.Type.GetType(String typeName, Boolean throwOnError)
at NHibernate.Cfg.Binder.BindComponent(XmlNode node, Component model,
Type reflectedClass, String className, String path, Boolean isNullable, Mappings mappings)
The way I read the exception, NHibernate is looking in the NHibernate assembly for my class instead of in my assembly
Where am I going wrong?
Thanks,
Chris
|