hi ,
I am new to NHibernate.
I am trying to setup this environment on VS 2010 with oracle as the
backend. I could gather some knowledge on this from the net.
I created a class library project and in the app.config i gave the
configuration settings and to the same class lib project i added the
mapping configurations hbm.xml file .
when i try to complie the app it does not show any error but when i
run this using a console app i get this exceprion "
System.InvalidException: could not find the dialect in the
configuration
at NHibernate.Dialect.dialect.getDialect(IDictionary'2 props)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary'2
properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.BuildSessionfactory()
at EmployeeTest.Program.Opensession() in C:/../Program.cs:Line 60
at EmployeeTest.Program.Main(String[] args) in C:/../Programs.cs :Line
20
my code looks as below
Employee.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Employee
{
public class Employee
{
virtual public int EmployeeID { get; set; }
virtual public string EmployeeName {get;set;}
virtual public int DepartmentNumber { get; set; }
virtual public string DepartmentName { get; set; }
virtual public int Salary { get; set; }
}
}
Employee.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Employee" lazy="true">
<id name="EmployeeId" >
<generator class="Assigned"/>
</id>
<property name="EmployeeName" column="EMPLOYEENAME" />
<property name="DepartmentNumber" column="DEPARTMENTNUMBER" />
<property name="DepartmentName" column="DEPARTMENTNAME" />
<property name="Salary" column="SALARY" />
</class>
</hibernate-mapping>
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<mapping xmlns="urn:nhibernate-configuration-2.2"/>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.Oracle9Dialect</
property>
<property
name="connection.provider">NHibernate.Connection.DriverConnectrionProvider</
property>
<property
name="connection.driver_class">NHibernate.Driver.OracleClientDriver</
property>
<property name="connection.connection_string"> Data
Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=10.4.30.78)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)
(SERVICE_NAME=EOSTestDB)));User Id=EOSUser;Password=Password11</
property>
</session-factory>
</hibernate-configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Core"
publicKeyToken="407DD0808D44FBDC" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.5.1.0"
newVersion="2.5.1.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Program.cs
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<mapping xmlns="urn:nhibernate-configuration-2.2"/>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.Oracle9Dialect</
property>
<property
name="connection.provider">NHibernate.Connection.DriverConnectrionProvider</
property>
<property
name="connection.driver_class">NHibernate.Driver.OracleClientDriver</
property>
<property name="connection.connection_string"> Data
Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=10.4.30.78)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)
(SERVICE_NAME=EOSTestDB)));User Id=EOSUser;Password=Password11</
property>
</session-factory>
</hibernate-configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Core"
publicKeyToken="407DD0808D44FBDC" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.5.1.0"
newVersion="2.5.1.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I referred to the following assemblies in both the Class Library and
Console Application.
Castle.Core
Castle.DynamicProxy2
Iesi.Collections
log4net
NHibernate.
also i set the Employee.hbm.xml build action to Embedded Resource
and app.config's copy to output dirctory as Copy Always
any help is greatly appreciated.
Thanks
Prashanth
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.