|
I am a beginner still testing around NHibernate. Please correct me if I got anything wrong.
I got a SalaryPlan class with Position as its component. The SalaryPlan class should be persisted to DB while Position is not. We have developed and used a library called MK.HrObject for this purpose.
The problem is that I don't know how to write the mapping file. Actually, I don't know how to tell NHibernate create the component instance. The Position object has a constructor for it but how can I call it?
Moreover, I don't know whether I got the following error message because my library is cached in GAC.
Error Message:
Could not load file or assembly 'MK.HrObject' or one of its dependencies. The system cannot find the file specified.
Hibernate version:
NHibernate 1.2.1.GA
Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="MK.SalaryPlanning.BO.SalaryPlan,MK.SalaryPlanning.BO" table="mkHrSalaryPlan_master">
<id name="Id" column="id" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<component name="Position" class="MK.HrObject.Position, MK.HrObject">
<property name="id" column="positionId"/>
</component>
<property column="year" type="Int32" name="Year" not-null="true" />
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
" at NHibernate.Cfg.Configuration.LogAndThrow(MappingException me) at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc) at NHibernate.Cfg.Configuration.ProcessMappingsQueue() at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document) at NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name) at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) at NHibernate.Cfg.Configuration.DoConfigure(XmlDocument doc) at NHibernate.Cfg.Configuration.Configure(XmlTextReader reader) at NHibernate.Cfg.Configuration.Configure(XmlNode node) at NHibernate.Cfg.Configuration.Configure() at Mekim.SalaryPlanning.DAL.BaseDataAccess.getFactory() in C:\Projects\Web Application\branches\SalaryPlanning\SalaryPlanning.DAL\BaseDataAccess.vb:line 25 at Mekim.SalaryPlanning.DAL.BaseDataAccess.OpenSession() in C:\Projects\Web Application\branches\SalaryPlanning\SalaryPlanning.DAL\BaseDataAccess.vb:line 36 at Mekim.SalaryPlanning.DAL.NHibernateHttpModule.context_BeginRequest(Object sender, EventArgs e) in C:\Projects\Web Application\branches\SalaryPlanning\SalaryPlanning.DAL\NHibernateHttpModule.vb:line 25 at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)"
Name and version of the database you are using:
SQL Server 2005
|