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.  [ 2 posts ] 
Author Message
 Post subject: Configuration Problem
PostPosted: Sun Sep 13, 2009 10:19 am 
Newbie

Joined: Sun Sep 13, 2009 10:10 am
Posts: 5
Hi All!

Before send this post, i've searched smilar problems on hibernate.org and another sites, but i can't find the solution. So there is my problem;
i've downloaded codesmith nhibernatemaster template from google code. and added it my project.then i create an app.config file, that is following code here.

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="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">Server=localhost;database=goingnuts;uid=sa;pwd=lol</property>
      <mapping assembly="MailList"/>
      <!-- NHibernate 2.1 -->
      <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
    </session-factory>
  </hibernate-configuration>
</configuration>


Error Line;
Code:
  _sessionFactory = new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();


Stack Trace
Code:
"   at NHibernate.Cfg.Environment.get_Properties()\r\n   at NHibernate.Cfg.Configuration.Reset()\r\n   at NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory)\r\n   at NHibernate.Cfg.Configuration..ctor()\r\n   at MailList.Data.Base.NHibernateSessionManager..ctor() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\Base\\NHibernateSessionManager.cs:line 68\r\n   at MailList.Data.Base.NHibernateSessionManager.get_Instance() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\Base\\NHibernateSessionManager.cs:line 40\r\n   at MailList.Data.Base.ManagerBase`2..ctor() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\Base\\ManagerBase.cs:line 54\r\n   at MailList.Data.ManagerObjects.ListManager..ctor() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\ManagerObjects\\ListManager.Generated.cs:line 20\r\n   at MailList.Data.ManagerObjects.ManagerFactory.GetListManager() in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Data\\ManagerObjects\\ManagerFactory.cs:line 34\r\n   at MailList.Demo.Program.Main(String[] args) in C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Demo\\Program.cs:line 16\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"


Inner Exception
Code:
{"An error occurred creating the configuration section handler for hibernate-configuration: An exception occurred parsing configuration :The element 'session-factory' in namespace 'urn:nhibernate-configuration-2.2' has invalid child element 'property' in namespace 'urn:nhibernate-configuration-2.2'. List of possible elements expected: 'mapping, class-cache, collection-cache, event, listener' in namespace 'urn:nhibernate-configuration-2.2'. (C:\\Users\\Eren\\Documents\\Visual Studio 2008\\Projects\\WebServices\\MailList.Demo\\bin\\Debug\\MailList.Demo.vshost.exe.config line 6)"}


Thanks.
Greetins From Turkiye


Top
 Profile  
 
 Post subject: Re: Configuration Problem
PostPosted: Sun Sep 13, 2009 5:23 pm 
Newbie

Joined: Sun Sep 13, 2009 10:10 am
Posts: 5
i changed my config file to this and my problem solved.
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="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">Server=Localhost;Database=MailList;Uid=sa;pwd=1b5e3f99;</property>
      <property name="connection.isolation">ReadCommitted</property>
      <property name="default_schema">MailList.dbo</property>
      <property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
      <!-- HBM Mapping Files -->
      <mapping assembly="MailList.Data" />
    </session-factory>
  </hibernate-configuration>
  <appSettings>
    <add key="appPath" value="C:\Users\Eren\Documents\Visual Studio 2008\Projects\WebServices\MailList.Demo"/>
  </appSettings>
</configuration>


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