.NET Daily

Common .NET Exceptions

Nhibernate Exception: Named Query Not Found: storedproceduremaname

Posted on .

Nhibernate Exception: Named Query Not Found: storedproceduremaname

Introduction

Nhibernate Exception: Named Query Not Found: storedproceduremaname

Scenario 1: You call a WCF service method to populate a repeater and at page load you are prompted with the above exception.

Resolution for Scenario 1: The above exception appears when Nhibernate doesn’t recognize the entity that you want to call. It could be triggered by multiple causes:

  1. The stored procedure doesn’t exists in the database;
  2. The stored procedure is not registered in the .hbm.xml configuration file;
  3. The mapping assembly for the current business layer is not specified in the web.config file:
  4. Ex:

    <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    	<session-factory>
    		<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    		<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
    		<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
    		<property name="show_sql">true</property>
    		<mapping assembly="MyBusinessNamespace" </mapping> 

    Check the above list of items on your solution and see if exception disappears.

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.

There are no comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

View Comments (0) ...
Navigation