Now, before you say it: I did Google and my hbm.xml
file is an Embedded Resource.
Here is the code I am calling:
Make sure you have called the CreateCriteria(typeof(DomainObjectType))
method on Session for the domain object which you intent to fetch from DB.
Should it be name="Id"
? Typos are a likely cause.
Next would be to try it out with a non-generic test to make sure you're passing in the proper type parameter.
Can you post the entire error message?
I had similar problem, and I solved it as folows:
I working on MS SQL 2008, but in the NH configuration I had bad dialect: NHibernate.Dialect.MsSql2005Dialect if I correct it to: NHibernate.Dialect.MsSql2008Dialect then everything's working fine without a exception "No persister for: ..." David.
Had a similar problem when find an object by id... All i did was to use the fully qualified name in the class name. That is Before it was :
find("Class",id)
Object so it became like this :
find("assemblyName.Class",id)
Spending about 4 hours on googling and stackoverflowing, trying all of stuff around there, i've found my error:
My mapping file was called .nbm.xml instead of .hbm.xml. That was insane.
I have a similar problem but all mentioned requirements are met. In my case I try to save some entity class (Type of OBJEKTE) back to the DB. Other places do work but only in this case it fails and raises this exception.
My solution (HACK) was to re-map the objet of type OBJEKTE again and store it then. Suddenly it works. But don't ask why.
OBJEKTE t = _mapper.Map<OBJEKTE>(inparam);
OBJEKTE res = await _objRepo.UpdateAsync(t);
If inparam would go straight to UpdateAsync() it cannot find a matching persistor.
It could be explained by the way NH does this. It derives a proxy from your mapping class and implements the properties with dirty handling included. See this:
t.GetType()
{Name = "OBJEKTE" FullName = "MyComp.Persistence.OBJEKTE"}
inparam.GetType()
{Name = "OBJEKTEProxyForFieldInterceptor" FullName = "OBJEKTEProxyForFieldInterceptor"}
The fun thing though is that the source of inparam
is in fact the NH repository itself. Anyways. I stay with this reassign hack for the next time being.