Te conviene leer esto:
http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/01/your-first-nhibernate-based-application.aspx

De todos modos lo mas probable es que no hayas hecho EmbeddedResource el
xml.

Estas usando una version muy vieja de NHibernate...

Gustavo.

On Tue, Jan 20, 2009 at 5:35 PM, Jorge Caballero <
[email protected]> wrote:

>
> Hola a toda la gente de la comunida. Espero no ser redundante al hacer
> esta pregunta, pero, la verdad necesito ayuda con este primer ejemplo
> con NHibernate que no me esta compilando bien. El error que me muestra
> es:
>
> Unknown entity class: FirstExampleNhibernate.Entities.Customer
>
> Ahora, la configuracion de NHibernet la hago en el App.config:
>
> App.config
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
>  <configSections>
>    <section name="nhibernate"
>             type="System.Configuration.NameValueSectionHandler,
> System,
>                        Version=1.0.5000.0,
>                  Culture=neutral,
>                        PublicKeyToken=b77a5c561934e089"/>
>  </configSections>
>  <nhibernate>
>    <add key="hibernate.connection.provider"
>         value="NHibernate.Connection.DriverConnectionProvider"/>
>    <add key="hibernate.dialect"
>         value="NHibernate.Dialect.MsSql2005Dialect" />
>    <add key="hibernate.connection.driver_class"
>         value="NHibernate.Driver.SqlClientDriver" />
>    <add key="hibernate.connection.connection_string"
>         value="Data Source=localhost;Initial
> Catalog=TestHibernate;Integrated Security=True" />
>  </nhibernate>
> </configuration>
>
> Tabla: Customer
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
> USE [TestHibernate]
> GO
> /****** Object:  Table [dbo].[Customer]    Script Date: 01/20/2009
> 13:23:55 ******/
>
> CREATE TABLE [dbo].[Customer](
>        [CustomerId] [int] IDENTITY(1,1) NOT NULL,
>        [Code] [char](10) COLLATE Modern_Spanish_CI_AS NOT NULL,
>        [Name] [varchar](160) COLLATE Modern_Spanish_CI_AS NOT NULL,
>        [Address] [varchar](160) COLLATE Modern_Spanish_CI_AS NOT NULL,
>  CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
>  (
>      [CustomerId] ASC
>  )WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
> ) ON [PRIMARY]
>
>
> Mapping: Customer.hbm.xml
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>                   assembly="FirstExampleNhibernate"
> namespace="FirstExampleNhibernate.Entities">
>  <class name="Customer" table="Customer">
>    <id name="Id">
>      <column name="CustomerId" sql-type="int"
>        not-null="true"/>
>      <generator class="identity"/>
>    </id>
>    <property name="Code" column="Code"/>
>    <property name="Name" column="Name"/>
>    <property name="Address" column="Address"/>
>  </class>
> </hibernate-mapping>
>
>
> Clase: NHibernateManager
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
> public class NHibernateManager
>    {
>        private static ISessionFactory nhFactory;
>        private static Configuration nhConfiguration;
>
>        public NHibernateManager()
>        {
>            nhConfiguration = new NHibernate.Cfg.Configuration();
>            nhConfiguration.AddAssembly("FirstExampleNhibernate");
>            nhFactory = nhConfiguration.BuildSessionFactory();
>        }
>
>        public static ISession NHSession()
>        {
>            return nhFactory.OpenSession();
>        }
>
>        public static void CloseSessionFactory()
>        {
>            if (nhFactory != null)
>                nhFactory.Close();
>        }
>    }
>
>
> Clase:
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>  public class CustomerDTO
>    {
>        public static void SaveCustomer(Customer cust)
>        {
>            NHibernateManager nhManager = new NHibernateManager();
>
>            ISession session = NHibernateManager.NHSession();
>            session.Save(cust);                        // Aca me tira
> error
>            session.Close();
>
>            NHibernateManager.CloseSessionFactory();
>        }
>    }
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>  Espero me pueda ayudar, ya que me quede trabado en esta parte.
> Agradezco a todos de antemano.
>
>
> Saludos.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Para escribir al Grupo, hágalo a esta dirección: 
[email protected]
Para más, visite: http://groups.google.com/group/NHibernate-Hispano
-~----------~----~----~----~------~----~------~--~---

Responder a