I think I may have found an issue with SessionFactoryImpl in the situation where you have a class with a composite-id with a key-many-to-one AND also a joined-subclass element
The problem appears to manifest itself if the mappings are read in the wrong order (which does not seem to be deterministic if using the load from assembly method)
The problem is this -- when the "PersisterFactory.Create( model, this )" call happens (see code below), if the model happens to be a class with a joined-subclass, it uses the NormalizedEntityPersister, which then processes a key-many-to-one to a class mapping which has not been processed yet and I get a "No persister found" error. (well, sometimes I get the error, sometimes everything works fine. It just depends if the dependent entity in that key-many-to-one has been processed before the key-many-to-one is executed)
Code:
In SessionFactaryImpl constructor:
...
foreach( PersistentClass model in cfg.ClassMappings )
{
System.Type persisterClass = model.ClassPersisterClass; // not used !?!
IClassPersister cp;
cp = PersisterFactory.Create( model, this ); <== I think this is the issue
classPersisters[ model.MappedClass ] = cp;
...
Any suggestions for a workaround?