I have just started to migrate to NHibernate 2.0.1.GA from 1.2.0.GA and have run into problems with my table mappings.
When my application starts it first run a stored procedure in the database (Firebird) to get a version of the current database. That works, which means that the database connection and the new XML-tags in app.config are configured correctly.
It then starts to load some data, and here I run into a major problem. My application crash with a FileNotFoundException in mscorlib.dll, "cannot find file NHibernate.XMLSerializers, Version=2.0.1.4000...." in the method "T Deserialize<T>(XmlNode node)" in file Binder.cs. When I trace back to my code, the exception is thrown when I call method AddAssembly() on my Configuration object.
When I check the log-file I can see the following:
Code:
2008-11-15 18:04:56,203 [1] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: MIEDatabaseMapping
2008-11-15 18:04:56,203 [1] INFO NHibernate.Cfg.Configuration - Mapping resource: MIE.NHibernateMapping.FastInputMapping.hbm.xml
2008-11-15 18:04:56,250 [1] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.FirebirdDialect
And then it crash...
This is the corresponding log from NHibernate 1.2:
Code:
2008-11-13 09:01:11,687 [1] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: MIEDatabaseMapping
2008-11-13 09:01:11,890 [1] INFO NHibernate.Cfg.Configuration - Adding embedded mapping document: MIE.NHibernateMapping.FastInputMapping.hbm.xml
2008-11-13 09:01:11,890 [1] INFO NHibernate.Cfg.Configuration - Mapping resource: MIE.NHibernateMapping.FastInputMapping.hbm.xml
2008-11-13 09:01:11,890 [1] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.FirebirdDialect
2008-11-13 09:01:11,890 [1] INFO NHibernate.Cfg.HbmBinder - Mapping class: MIE.DatabaseMapping.FastInputMapping -> fastinput
...............and more mappings........
Searching the Internate (i.e. Google) tells me that I shouldn't need to make any changes to the mapping files during the migration. Here is the mapping file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="MIE.DatabaseMapping.FastInputMapping, MIEDatabaseMapping" table="fastinput" lazy="true">
<id name="Id" column="id" type="int" unsaved-value="0">
<generator class="sequence">
<param name="sequence">gen_fastinput_id</param>
</generator>
</id>
<bag name="FastInputAreas" collection-type="MIE.DatabaseMapping.BaseMappingList`1[MIE.DatabaseMapping.FastInputAreaMapping], MIEDatabaseMapping" inverse="true" cascade="all-delete-orphan" order-by="text_idx">
<key>
<column name="fastinput_id"/>
</key>
<one-to-many class="MIE.DatabaseMapping.FastInputAreaMapping, MIEDatabaseMapping"/>
</bag>
</class>
</hibernate-mapping>
What can be the problem?
Shall the mapping assembly be build any differently in 2.0?
Just for my personal peace of mind, I tried the AddFile() method on the configuration object, adding a single mapping file, but the result was the same.