Hibernate Books

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Could not compile the mapping document
PostPosted: Mon Sep 07, 2009 12:43 am 
Newbie

Joined: Mon Sep 07, 2009 12:28 am
Posts: 3
Here are my files...

App.config
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <configSections>
    <section name="hibernate-configuration"
           type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>
 
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <qualifyAssembly partialName="FirebirdSql.Data.FirebirdClient" fullName="FirebirdSql.Data.FirebirdClient, Version=2.5.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
    </assemblyBinding>
  </runtime>

  <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.FirebirdClientDriver</property>
      <property name="connection.connection_string">Server=localhost;Database=C:\PATIENTS.FDB;User=SYSDBA;Password=masterkey</property>
      <property name="show_sql">false</property>
      <property name="dialect">NHibernate.Dialect.FirebirdDialect</property>
      <property name="command_timeout">60</property>
      <property name="query.substitutions">true 1, false 0, yes 1, no 0</property>
      <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
     
      <mapping resource="MyNH.Patients.hbm.xml" assembly="MyNH" />
    </session-factory>
  </hibernate-configuration>
 
</configuration>


Patients.cs
Code:
using System;
using System.Collections.Generic;
using System.Text;

namespace MyNH
{
    class Patients
    {
        private int pID;
        private string fName;
        private string lName;
        private string tel;
        private string email;
        private string addr;
        private char gender;

        public Patients()
        {
        }

        public int PID
        {
            get { return pID; }
            set { pID = value; }
        }

        public string FName
        {
            get { return fName; }
            set { fName = value; }
        }

        public string LName
        {
            get { return lName; }
            set { lName = value; }
        }

        public string Tel
        {
            get { return tel; }
            set { tel = value; }
        }

        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        public string Addr
        {
            get { return addr; }
            set { addr = value; }
        }

        public char Gender
        {
            get { return gender; }
            set { gender = value; }
        }

    }
}


Program.cs
Code:
using System;
using System.Collections.Generic;
using System.Text;

using NHibernate;
using NHibernate.Cfg;

namespace MyNH
{
    class Program
    {
        static void Main(string[] args)
        {
            Configuration cfg = new Configuration();
            cfg.AddAssembly("MyNH");

            ISessionFactory factory = cfg.BuildSessionFactory();
            ISession session = factory.OpenSession();
            ITransaction transaction = session.BeginTransaction();

            Patients newPatient = new Patients();
            newPatient.PID = 4;
            newPatient.FName = "r";
            newPatient.LName = "i";
            newPatient.Tel = "1234353454";
            newPatient.Email = "ri@gmail.com";
            newPatient.Addr = "Malabe";
            newPatient.Gender = 'F';

            session.Save(newPatient);

            transaction.Commit();
            session.Close();

        }
    }
}



I'm getting an error at "cfg.AddAssembly("MyNH");" line in "Program.cs"

error : Could not compile the mapping document: MyNH.Patients.hbm.xml
innerException: Could not instantiate dialect class NHibernate.Dialect.FirebirdDialect

I have added "FirebirdSql.Data.FirebirdClient.dll", "Iesi.Collections.dll", "NHibernate.dll" and "LinFu.DynamicProxy.dll" as references.

Thanks for any help.


Top
 Profile  
 
 Post subject: Re: Could not compile the mapping document
PostPosted: Mon Sep 07, 2009 2:19 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Just a guess, you have to qualify the classname of the driver:

<property name="dialect">NHibernate.Dialect.FirebirdDialect, FirebirdSql.Data.FirebirdClient.dll</property>

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: Could not compile the mapping document
PostPosted: Mon Sep 07, 2009 8:05 am 
Newbie

Joined: Mon Sep 07, 2009 12:28 am
Posts: 3
Thanks for the reply. It didn't fix the problem still. Now it says

error : Could not compile the mapping document: MyNH.Patients.hbm.xml
innerException: Could not instantiate dialect class NHibernate.Dialect.FirebirdDialect, FirebirdSql.Data.FirebirdClient.dll


Top
 Profile  
 
 Post subject: Re: Could not compile the mapping document
PostPosted: Wed Sep 09, 2009 11:12 am 
Newbie

Joined: Wed Sep 09, 2009 11:02 am
Posts: 1
I'd like to know if you get this fixed, as I'm experiencing an almost identical problem. I am upgrading my version of nHibernate from 1.x to 2.x, and my stuff isn't building either.

Top level error is:
Could not instantiate dialect class NHibernate.Dialect.OracleDialect

And down a level is:
Could not load type NHibernate.Dialect. Possible cause: no assembly name specified."

Any help would be keen. Here's my file:

<configuration>

<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="TestSessionFactory">
<property name="dialect">NHibernate.Dialect.OracleDialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
<property name="connection.connection_string">Data Source=XXXX;User ID=XXXX;Password=XXXX;</property>
<property name="connection.isolation">ReadCommitted</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<!-- HBM Mapping Files -->
<mapping assembly="XXXXDataAccess.Core" />
</session-factory>
</hibernate-configuration>

</configuration>

Thanks,
EyeVeeDrip


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.