I think I may be running into the same problem. I'm trying to subclass a class in another namespace that has the same name.
I want to subclass a class named "AT.Persistence.Entity.User" with the name "Reservations.Persistence.Entity.User."
I'm using the following mapping file. I also tried making the name in the subclass element fully qualified, but, it didn't seem to help.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
assembly="ReservationsLibrary"
namespace="Reservations.Persistence.Entity">
<subclass name="User" extends="AT.Persistence.Entity.User, ATLibrary">
</subclass>
</hibernate-mapping>
And I'm getting the following exception when I attempt to create the database using SchemaExport.
Code:
Unhandled Exception: NHibernate.MappingException: duplicate import: User
at NHibernate.Cfg.Mappings.AddImport(String className, String rename)
at NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
at NHibernate.Cfg.Binder.BindSubclass(XmlNode node, Subclass model, Mappings mappings)
at NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
at NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering)
at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
at Reservations.Program.Main(String[] args) in C:\Documents and Settings\jemiller\My Documents\Visual Studio 2005\Projects\Reservations\CreateDatabase\Program.cs:line 20
Does anyone know if it's possible to do this? Or, is it a known limitation? Was it ever fixed previously?