These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Mapping problem with component
PostPosted: Wed Feb 13, 2008 3:56 am 
Newbie

Joined: Tue Sep 05, 2006 11:15 pm
Posts: 7
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 03, 2008 2:57 am 
Newbie

Joined: Tue Sep 05, 2006 11:15 pm
Posts: 7
I have already found out the solution. It's the fault of my planning. The actual position property should be populated later in the DAO instead of using the NHibernate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.