NHibernate.MappingException (no persister for) weirdness
- by Berryl
The weird part being that I have other tests that validate the mapping and even the method being called (Nhib session.SaveOrUpdate) that run just fine.
The entire exception is below.
Here is some debug output from a test that does work:
Item type: Domain.Model.Projects.Project item: 007-00-056 ATM Machine Replacement
Is transient: True Id: 0
NHibernate: INSERT INTO Projects (Code, Description) VALUES (@p0, @p1); select insert_rowid();@p0 = '007-00-056', @p1 = 'ATM Machine Replacement'
Here is the same debug output before the exception:
Item type: Smack.ConstructionAdmin.Domain.Model.Projects.Project item: 006-00-023 Refinish Casino Chairs
Is transient: True Id: 0
The two tests are different in that the one that works is just testing the repository, and saving in memory test data. The failing one is saving data that has been converted from a legacy db (which has it's own session). The repository is also a replacement design for a different IProjectRepsitory that worked fine doing this, so the new repository is also a likely suspect here.
Does anyone see what I'm missing or have some questions to narrow it down?
Cheers,
Berryl
=== the Exception trace =====
failed: NHibernate.MappingException : No persister for: Domain.Model.Projects.Project
at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName)
at NHibernate.Impl.SessionImpl.GetEntityPersister(String entityName, Object obj)
at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.Save(Object obj)
NHibernate\Repository\NHibRepository.cs(40,0): at Core.Data.NHibernate.Repository.NHibRepository`1.Add(T item)
Repositories\ProjectRepository.cs(30,0): at Data.Repositories.ProjectRepository.SaveAll(IEnumerable`1 projects)
LegacyConversion\LegacyBatchUpdater.cs(20,0): at Data.LegacyConversion.LegacyBatchUpdater.ConvertOpenLegacyProjects(ILegacyProjectDao legacyProjectDao, IProjectRepository greenProjectRepository)
Data\Brownfield\ProjectBatchUpdate_SQLiteTests.cs(31,0): at .Tests.Data.Brownfield.ProjectBatchUpdate_SQLiteTests.Test()