Hi, i am using nHibernate for my Engeneering Tesis in the University and have this problem, please if somebody could help me i will appreciate it very much!
Hibernate version: Build 1.2.0.GA
Visual Studio 2005
ASP.net with VB as language
Mapping documents:
Web.config content:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Server=(local);database=quickstart;user=ingenio;pwd=ingenio</property>
<mapping assembly="NHCat"/>
</session-factory>
</hibernate-configuration>
<system.web>...not relevant...</system.web>
</configuration>
---------------------------------
NHCat.hbm.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHCat" assembly="NHCat" default-lazy="false">
<class name="Cat" table="Cat">
<id name="Id" column="CatId" type="Int32">
<generator class="identity"/>
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="Name" type="String" column="Name" />
<property name="Sex" type="String" column="Sex" />
<property name="Weight" type="Double" column="Weight" />
</class>
</hibernate-mapping>
----------------------------------
Full stack trace of any exception that occurs:
(Some errors appear in Spanish, but the important results are in english, let me know if you do not understand something please).
[HibernateException: The dialect was not set. Set the property hibernate.dialect.]
NHibernate.Dialect.Dialect.GetDialect() +120
NHibernate.Dialect.Dialect.GetDialect(IDictionary props) +133
NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +57
[MappingException: Could not compile the mapping document: NHCat.NHCat.hbm.xml]
Microsoft.VisualBasic.CompilerServices.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags) +402
Microsoft.VisualBasic.CompilerServices.NewLateBinding.CallMethod(Container BaseReference, String MethodName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, BindingFlags InvocationFlags, Boolean ReportErrors, ResolutionFailure& Failure) +421
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn) +297
NHibernateHelper..cctor() in C:\Documents and Settings\Walter\Mis documentos\Visual Studio 2005\WebSites\QuickStart\App_Code\NHibernateHelper.vb:15
[TypeInitializationException: Se produjo una excepción en el inicializador de tipo de 'NHibernateHelper'.]
NHibernateHelper.GetCurrentSession() in C:\Documents and Settings\Walter\Mis documentos\Visual Studio 2005\WebSites\QuickStart\App_Code\NHibernateHelper.vb:32
NHCat._Default.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Walter\Mis documentos\Visual Studio 2005\WebSites\QuickStart\Default.aspx.vb:17
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +96
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +117
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838
----------------------------------------------------
Name and version of the database you are using:
SQL Server 2005
----------------------------------------------------
I do not found any ASP.net with VB examples in Internet, and this error apparently has to do with Nhibernate not able to find Web.config, and that
is the cause that it is telling:
"The dialect was not set. Set the property hibernate.dialect"
This is the project in Visual Studio: