Fixed
Details
Details
Assignee
Kailuo Wang
Kailuo WangReporter
Gerard Eviston
Gerard EvistonComponents
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created September 2, 2008 at 2:14 AM
Updated September 9, 2008 at 9:08 PM
Resolved September 9, 2008 at 9:08 PM
This problem happens when multiple persistent units are loaded (i.e. when you use more than one nhibernate config file). If you try to persist a type that is not defined in the first PU, it can result in an unhandled MappingException. The problem appears to be the following code from PersistentUnitRepo:GetPU(Type t):
foreach (PersistenceUnit pu in persistenceUnits)
{
ISessionFactoryImplementor sfi = (ISessionFactoryImplementor) pu.SessionFactory;
if (sfi.GetEntityPersister(t) != null)
{
return pu;
}
}
With NHibernate 2.0.0.3001, GetEntityPersister() throws a MappingException if the persister cannot be found.
The attached patch just surrounds the call with try/catch.