I used this statement to load the mapping file.
Configuration cfg = new Configuration().AddXmlFile("ParameterRepository.hbm.xml");
However it said that missing the hibernate.dialect...
Here is the error message:
/*
1) Castor.Installation.Parameter.UsageDemoUnitTestCase.Demo2 : NHibernate.MappingException : Could not compile the mapping document: ParameterRepository.hbm.xml
----> NHibernate.HibernateException : The dialect was not set. Set the property hibernate.dialect.
at NHibernate.Cfg.Configuration.LogAndThrow(MappingException me)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
at NHibernate.Cfg.Configuration.AddXmlFile(String xmlFile)
at Castor.Installation.Parameter.UsageDemoUnitTestCase.Demo2() in e:\cstcs\installation_parameter_management_1.0_dev_dist\src\csharp\tests\Castor\Installation\Parameter\Demo.cs:line 38
--MappingException
at NHibernate.Dialect.Dialect.GetDialect()
at NHibernate.Dialect.Dialect.GetDialect(IDictionary props)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
*/
If I simply use
/*
_sessionFactory = new Configuration().Configure().BuildSessionFactory();
*/
it works, as I placed those configurations in the hybernate.cfg.xml.
But the mapping files are not loaded...
I was wondering why the first approach doesn't work??
Could anyone please give me some instructions?
Thanks very very very very much!
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html