Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# gedw99 2/18/2007 4:59 PM (edited 2/18/2007 5:36 PM)
i am writing a module and decided to copy the Articles code to use it as a pattern for the new module called "photos".
I ensured that the domain model hbms are embedeed and did an rebuild.

Everything looks ok in the DB and code. Th new module installs fine.
But when running if i go to an article section and then to a Photo section , i get an error relating to the domain model of:
"duplicate import".

Now the namespaces of the Articles model and the new Photos model are different, so they should not clash when NHibernate is scooping them up and loading them into memory. But this is exactly where is crashes on line 33. see code below.

Any ideas really welcome as i am stuck !!



ged




duplicate import: Comment
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: NHibernate.MappingException: duplicate import: Comment

Source Error:

Line 31: {
Line 32: Configuration nhConfiguration = this._kernel[typeof(Configuration)] as Configuration;
Line 33: nhConfiguration.AddAssembly(assembly);
Line 34: ISessionFactory newSessionFactory = nhConfiguration.BuildSessionFactory();
Line 35: ReplaceSessionFactory(newSessionFactory);


Source File: C:\_DataGerard\ProjectsCurrent\Shixango\Code\SVNLive\Branches\1.5.0\Core\Service\SessionFactoryHelper.cs Line: 33

Stack Trace:

[MappingException: duplicate import: Comment]
NHibernate.Cfg.Mappings.AddImport(String className, String rename) +151
NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping) +565
NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings) +56
NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model) +614
NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc) +96
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream) +103
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering) +243
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) +6
Cuyahoga.Core.Service.SessionFactoryHelper.AddAssembly(Assembly assembly) in C:\_DataGerard\ProjectsCurrent\Shixango\Code\SVNLive\Branches\1.5.0\Core\Service\SessionFactoryHelper.cs:33
Cuyahoga.Web.Components.ModuleLoader.GetModuleFromType(ModuleType moduleTypeMetaData) in C:\_DataGerard\ProjectsCurrent\Shixango\Code\SVNLive\Branches\1.5.0\Web\Components\ModuleLoader.cs:101
Cuyahoga.Web.Components.ModuleLoader.GetModuleFromSection(Section section) in C:\_DataGerard\ProjectsCurrent\Shixango\Code\SVNLive\Branches\1.5.0\Web\Components\ModuleLoader.cs:42
Cuyahoga.Web.UI.PageEngine.CreateModuleControlForSection(Section section) in C:\_DataGerard\ProjectsCurrent\Shixango\Code\SVNLive\Branches\1.5.0\Web\UI\PageEngine.cs:335
Cuyahoga.Web.UI.PageEngine.LoadContent() in C:\_DataGerard\ProjectsCurrent\Shixango\Code\SVNLive\Branches\1.5.0\Web\UI\PageEngine.cs:316
Cuyahoga.Web.UI.PageEngine.OnInit(EventArgs e) in C:\_DataGerard\ProjectsCurrent\Shixango\Code\SVNLive\Branches\1.5.0\Web\UI\PageEngine.cs:239
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
# gedw99 2/18/2007 5:39 PM
Alos in working through this problem of course it fails later too when performing any queries using the Module it THINKS have already been loaded.

The Module loading code need to realise that it has failed perhaps.

G
# martijnb 2/19/2007 6:38 AM
In the mapping files, you have to set auto-import="false". After that, you have to specify the full class name in hql queries or define aliases in the mapping file. See also http://www.hibernate.org/hib_docs/nhibernate/html/mapping.html, section 5.1.16.
# gedw99 2/21/2007 4:17 AM
Martin,

you are a god.

thanks

ged