<?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.connection_string">
Server=sqlserver;Initial Catalog=mydb;User
Id=username;Password=password
</property>
<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu
</property>
</session-factory>
</hibernate-configuration>
</configuration>
And my execution file looks like this:
public ExecutionService()
{
Configuration cfg = new Configuration();
cfg.AddFile("hibernate.cfg.xml");
ISessionFactory factory = cfg.BuildSessionFactory();
session = factory.OpenSession();
}
Besides that, i set the config of hibernate.cfg.xml to always copy to
the bin directory
But I keep getting the following exception:
NHibernate.MappingException: Could not compile the mapping document:
hibernate.cfg.xml ---> System.InvalidOperationException: Could not
find the dialect in the configuration
Any ideas? I've tried every existing sort of configuration without
success :-(
Best regards,
Jan
Use *just* this for your hibernate.cfg.xml (no configSections stuff
needed):
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</
property>
<property name="connection.connection_string">
Server=sqlserver;Initial Catalog=mydb;User
Id=username;Password=password
</property>
<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu
</property>
</session-factory>
</hibernate-configuration>
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
Hello Robert,
I thought that was in older versions. Somewhere I read the new
convention was just "dialect" and without using keys.
Jan
On 10 Feb., 17:26, Robert Rudduck <rob...@rpowered.net> wrote:
> The declaration for dialect should be...
>
> <add key="hibernate.dialect" value="" />
>
> This link may help you out:
>
> https://www.hibernate.org/362.html
>
Tried using sbohlens code, but I still get the same exception.
@Robert Rudduck
I thought that was the old convention.
I read somewhere that since 2.0 there is no "hibernate.dialect" but
just "dialect" and there are no keys but properties.
Any other ideas?
Jan
On 10 Feb., 17:26, Robert Rudduck <rob...@rpowered.net> wrote:
> The declaration for dialect should be...
>
> <add key="hibernate.dialect" value="" />
>
> This link may help you out:
>
> https://www.hibernate.org/362.html
>
> > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
my hibernate.cfg.xml looks now like this:
<?xml version="1.0" encoding="utf-8" ?>
<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.connection_string">
Server=server;Initial Catalog=db;User
Id=username;Password=password
</property>
<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu
</property>
</session-factory>
</hibernate-configuration>
and my class:
...
public ExecutionService()
{
Configuration cfg = new Configuration();
cfg.AddFile("hibernate.cfg.xml");
ISessionFactory factory = cfg.BuildSessionFactory();
session = factory.OpenSession();
}
...
Unbehandelte Ausnahme: NHibernate.MappingException: Could not compile
the mapping document: hibernate.cfg.xml --->
System.InvalidOperationException: Could not find the dialect in the
configuration
bei NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props)
bei
NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
doc)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
bei
NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
doc)
bei NHibernate.Cfg.Configuration.ProcessMappingsQueue()
bei
NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument
document)
bei NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader,
String name)
bei NHibernate.Cfg.Configuration.AddXmlFile(String xmlFile)
bei NHibernate.Cfg.Configuration.AddFile(String xmlFile)
bei....ExecutionService..ctor() in ...ExecutionService.cs:Zeile 20.
bei ....Program.Main(String[] args) in ...Program.cs:Zeile 12.
Any other ideas?
my config file is being copied to the bin/Release folder.
I also just tried deleting it and when I do so, I get a "file not
found" error, so I think it is being copied and found.
I could start crying now :(
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
Jan
On 11 Feb., 13:24, Fabio Maulo <fabioma...@gmail.com> wrote:
> Configuration cfg = new Configuration();
> cfg.AddFile("hibernate.cfg.xml");
> ISessionFactory factory = cfg.BuildSessionFactory();
> session = factory.OpenSession();
>
> In that code you are adding the session-factory configuration as a mapping
> file.
> Please review this wikihttp://nhforge.org/wikis/howtonh/your-first-nhibernate-based-applicat...
>
> 2010/2/10 Jan Apel <jan.a...@gmail.com>
> > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com>