NHibernate.MappingException - Troubles Shooting Checklist (no persister for)

Posted by Berryl on Stack Overflow See other posts from Stack Overflow or by Berryl
Published on 2010-03-19T23:05:27Z Indexed on 2010/03/22 17:21 UTC
Read the original article Hit count: 398

Here's a starter list:
1) if hbm is hand generated, is it an embedded resource?
2) if using FNH, does it pass a PerssistenceSpecification test?
3) if not using FNH, can you save and then load the persisted class?
4) more?

I'm sure many of you have gotten this one at one point or another. But have you ever gotten it when you knew your mapping was set up correctly?

I started getting this exception after I started using a new repository design, but only in one scenario! PersistenceSpecification tests pass, as do all repository methods (using SQLite).

The scenario that leads to the exception is when legacy projects from a different db are converted to green field system. The legacy system is from a different database and has it's own session factory, which should be irrelevant because the error comes after previously unconverted Projects are retrieved and in memory.

As the routine tries to save these unconverted Projects into the new database, the exception is thrown, full stack trace below.

Any ideas on how to build up the trouble shooting check list and solves this problem?

Cheers, Berryl

=== the Exception trace =====

failed: NHibernate.MappingException : No persister for: Smack.ConstructionAdmin.Domain.Model.Projects.Project
at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName)
at NHibernate.Impl.SessionImpl.GetEntityPersister(String entityName, Object obj)
at NHibernate.Engine.ForeignKeys.IsTransient(String entityName, Object entity, Nullable`1 assumed, ISessionImplementor session)
at NHibernate.Event.Default.AbstractSaveEventListener.GetEntityState(Object entity, String entityName, EntityEntry entry, ISessionImplementor source)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event)
at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj)
NHibernate\Repository\FabioNHibRepository.cs(46,0): at Smack.Core.Data.NHibernate.Repository.FabioNHibRepository`1.Add(T item)
LegacyConversion\LegacyBatchUpdater.cs(20,0): at Smack.ConstructionAdmin.Data.LegacyConversion.LegacyBatchUpdater.ConvertOpenLegacyProjects(ILegacyProjectDao legacyProjectDao, IProjectRepository greenProjectRepository)
Data\Brownfield\ProjectBatchUpdate_SQLiteTests.cs(19,0): at Smack.ConstructionAdmin.Tests.Data.Brownfield.ProjectBatchUpdate_SQLiteTests.Test()

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about nhibernate-mapping