-->
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: Mapping assembly problem with NHibernate 2.0
PostPosted: Sat Nov 15, 2008 1:24 pm 
Beginner
Beginner

Joined: Wed Nov 08, 2006 8:24 am
Posts: 26
Location: Gothenburg, Sweden
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 16, 2008 12:39 pm 
Beginner
Beginner

Joined: Wed Nov 08, 2006 8:24 am
Posts: 26
Location: Gothenburg, Sweden
Problem solved. My debugger in Visual Studio was set to break on all exceptions, adjusting the exception settings fixed my problem.

See also http://www.nablasoft.com/alkampfer/index.php/2008/02/13/sgenexe-and-strongly-named-assemblies/


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.