-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: NHibernate with mssql
PostPosted: Thu Aug 06, 2009 2:59 am 
Newbie

Joined: Thu Aug 06, 2009 2:22 am
Posts: 4
Hi there, I am reading "NHibernate in action" ebook. And the first sample is to make simple console project using mssql 2000 dbase.
I already set up everything including the database, but there is an error :
"Could not instantiate dialect class NHibernate.Dialect.MsSql2000Dialect"

Anyone know the solution ?

thanks

open session method :
Code:
static ISession OpenSession()
{
    if(factory == null)
    {
        Configuration c = new Configuration();
        c.AddAssembly(Assembly.GetCallingAssembly());
        factory = c.BuildSessionFactory();
    }
    return factory.OpenSession();
}
static ISessionFactory factory;


Employee class :
Code:
class Employee
  {
       public int id;
       public string name;
       public Employee manager;
       public string SayHello()
       {
            return string.Format(
                "'Hello World!', said {0}.", name);
       }
  }


app.config :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="hibernate-configuration"
              type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
<property name="connection.provider">
        NHibernate.Connection.DriverConnectionProvider
      </property>
      <property name="connection.driver_class">
        NHibernate.Driver.SqlClientDriver
      </property>
      <property name="connection.connection_string">
         Server=(local);database=HelloNHibernate;Integrated Security=SSPI;
      </property>
      <property name="dialect">
        NHibernate.Dialect.MsSql2000Dialect
      </property>
      <property name="show_sql">
        false
      </property>
    </session-factory>
  </hibernate-configuration>
</configuration>


Employee.hbm.xml :
Code:
<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    auto-import="true">
  <class name="HelloNHibernate.Employee, HelloNHibernate" lazy="false">
    <id name="id" access="field">
      <generator class="native" />
    </id>   
    <property name="name" access="field" column="name"/>
    <many-to-one access="field" name="manager" column="manager"
        cascade="all"/>
  </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: Re: NHibernate with mssql
PostPosted: Fri Aug 14, 2009 2:10 am 
Newbie

Joined: Thu Aug 06, 2009 2:22 am
Posts: 4
still waiting for help ...


Top
 Profile  
 
 Post subject: Re: NHibernate with mssql
PostPosted: Fri Aug 14, 2009 7:39 pm 
Newbie

Joined: Fri Aug 14, 2009 7:12 pm
Posts: 2
i did the same coding as yours, i think i've got a similar problem but i m using Microsoft SQL Server 2005 -> SQL Server Management Studio Express... but mine there is error and it cannot locate the NHibernate.exe. Where did u save the project?


Top
 Profile  
 
 Post subject: Re: NHibernate with mssql
PostPosted: Sat Aug 15, 2009 12:00 pm 
Newbie

Joined: Thu Aug 06, 2009 2:22 am
Posts: 4
eqa_m wrote:
i did the same coding as yours, i think i've got a similar problem but i m using Microsoft SQL Server 2005 -> SQL Server Management Studio Express... but mine there is error and it cannot locate the NHibernate.exe. Where did u save the project?


o...
I just add the nhibernate.dll into projects's references


Top
 Profile  
 
 Post subject: Re: NHibernate with mssql
PostPosted: Thu Aug 20, 2009 1:08 pm 
Newbie

Joined: Thu Aug 06, 2009 2:22 am
Posts: 4
still waiting for the solution ... thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.