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.  [ 4 posts ] 
Author Message
 Post subject: NHibernate Setup Help
PostPosted: Mon Jun 01, 2009 5:13 pm 
Newbie

Joined: Mon Jun 01, 2009 5:07 pm
Posts: 3
Like so many others, I am trying to get NHibernate up and running. I have consulted the documentation, blogs, etc. and have come here as a last ditch effort to get this running. Thank you for any insight and help ahead of time....

Here is my hibernate.cfg.xml file contents :

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 xmlns="urn:nhibernate-configuration-2.2">
      <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
      <property name="hibernate.dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.connection_string">
        DataSource=.\SQLEXPRESS;InitialCatalog=haloData.mdf;User Instance=True;Integrated Security=True
      </property>
    </session-factory>
  </hibernate-configuration>

</configuration>


Here is my main class:
Code:
using System;
using System.Collections.Generic;

using NHibernate;
using NHibernate.Cfg;

namespace MyTest
{
    class Program
    {
        static void Main(string[] args)
        {

            ISessionFactory _sessionFactory;
            ISession _session;
            ITransaction _transaction;

            Configuration configuration = new Configuration();
            //configuration.Configure();
            _sessionFactory = configuration.BuildSessionFactory();
            _session = _sessionFactory.OpenSession();
            _transaction = _session.BeginTransaction();


            // _transaction.Rollback();
            _transaction.Dispose();
            _session.Close();
            _session.Dispose();

        }
    }
}



The resultant error:
Code:
The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>


Top
 Profile  
 
 Post subject: Re: NHibernate Setup Help
PostPosted: Wed Jun 03, 2009 3:55 pm 
Newbie

Joined: Mon Jun 01, 2009 5:07 pm
Posts: 3
bump..


Top
 Profile  
 
 Post subject: Re: NHibernate Setup Help
PostPosted: Thu Jun 04, 2009 2:19 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Hmm, is the configuration file read at all ? Is the config file copied to your build directory ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: NHibernate Setup Help
PostPosted: Thu Jun 04, 2009 9:02 pm 
Newbie

Joined: Mon Jun 01, 2009 5:07 pm
Posts: 3
Thank you for responding.

Yes, the configuration file is being placed in the build directory.


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.