Skip to content

NHibernate Issues – Unable to locat persister

September 25, 2013

A lot of NHibernate issues had to resolve as I made drastic changes to most of the codebase involving changing the version of NHibernate so it reflects on all related projects.

Never had I encountered more NHibernate problems in the last week of that space of time in comparison to the errors encountered over the last year. It was that horrendous!! I will look at NHibernate as a high maintenance person (I mean cough *woman*) !!

The most common of errors encountered over the last few days is Unable to locate persister which always crops up from time to time. See this error: –

Unable to locate persister for the entity named ‘ClassName
The persister define the persistence strategy for an entity.
Possible causes:
 – The mapping for ‘ClassName‘ was not added to the NHibernate configuration.

There are a number of issues as to why this is caused: –

1) The NHibernate mapping file is not set to ClassName.hbm.xml

2) The NHibernate mapping file is not set as embedded resources

3) If these fail, debug and when it fails, catch the exception and look at the InnerException – NHibernate has fantastic error messaging hidden in there.

But I personally think that NHibernate cannot see this on the database or that you are referring to the wrong database or project code base. I say “codebase” because you may refer to a DLL thats pointing to another database that NHibernate is completely unaware of!! From experience answer 3 and my personal answer is the most likely problem!

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: