Hello All,
I am new to NHibernate and badly stuck in a problem.
My Project is a web based application in which i am using NHibernate Mapping Attributes to generate my hbm file. Also I added a DLL of an existing Project with embeded hbm file of that project in it. All my reference tables are from that dll e.g Country, Booking Status etc and i am using version 1.0.2 with SQL Server 2005
My Dll names are :
1. AM.Library (new project dll)
2. EMSServerLib (old project dll)
My Question is:
How to write Mapping Attribute for reference tables which exist in some other dll.
I am writing this code to declare
[Set(0, Name = "OperatorSet", Lazy = false, Inverse = true)]
[Key(1, Column = "OperatorId")]
[OneToMany(2, Class = "EMS.Server.DataObjects.Operator, EMSServerLib")]
private EMS.Server.DataObjects.Operator m_operator;
public Operator Operator
{
get
{
return m_operator;
}
set
{
m_operator = value;
}
}
Quote:
The Generated HBM File look like this with auto import = false.
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by NHibernate.Mapping.Attributes on 2008-05-18 22:34:42Z.-->
<hibernate-mapping default-access="field.camelcase-underscore" auto-import="false" xmlns="urn:nhibernate-mapping-2.0">
<class name="AM.Library.AMSurvey, AM.Library" table="AM_SeismicSurvey">
<id name="SurveyId" column="SurveyId">
<generator class="identity" />
</id>
<set name="OperatorSet" lazy="false" inverse="true">
<key column="OperatorId" />
<one-to-many class="EMS.Server.DataObjects.Operator, EMSServerLib" />
</set>
</class>
</hibernate-mapping>
and my exception is :
[TypeLoadException: Could not load type 'EMS.Server.DataObjects.Operator, EMSServerLib', check that type and assembly names are correct]
NHibernate.Util.ReflectHelper.ClassForName(String name) +124
NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage) +27
[MappingException: associated class not found: EMS.Server.DataObjects.Operator, EMSServerLib]
NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage) +77
NHibernate.Cfg.Binder.BindOneToMany(XmlNode node, OneToMany model, Mappings mappings) +55
NHibernate.Cfg.Binder.BindCollection(XmlNode node, Collection model, String className, String path, Mappings mappings) +378
NHibernate.Cfg.CollectionTypeSet.Create(XmlNode node, String prefix, String path, PersistentClass owner, Mappings mappings) +56
NHibernate.Cfg.Binder.PropertiesFromXML(XmlNode node, PersistentClass model, Mappings mappings) +205
NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings) +2690
NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model) +609
NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc) +96
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream) +103
Csla.NHibernate.Cfg.BuildSessionFactory(String factoryCfg) +279
Csla.NHibernate.Cfg.AddNewKey(String key) +203
Csla.NHibernate.Cfg.CheckKeyInTable(String key) +63
Csla.NHibernate.Cfg.get_Item(String index) +42
Csla.NHibernate.Cfg.GetSessionFactory(String key) +63
Please Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html