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.  [ 1 post ] 
Author Message
 Post subject: Configuration problem
PostPosted: Wed Jul 19, 2006 9:33 am 
Beginner
Beginner

Joined: Tue May 30, 2006 10:55 am
Posts: 21
I am trying to configure nhibernate by loading the xml files from a assembly. My problem is that the assembly can not be found. If I deploy my application I have an application directory. Inside of the directory I have two other subdirectories called "Extensions" and "Plugins". The assembly I want to use is inside of the Extension directory, but the configuration will be called from the main application directory.

How do I set the directory where nhibernate can find the assembly with the mapping files? At the moment I have the following files and it does not work:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0" >
   <session-factory name="NHibernate.JetDb">
      <!-- properties -->
      <!-- Connection provider -->
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <!-- Driver -->
      <property name="connection.driver_class">NHibernate.Driver.OleDbDriver</property>
      <!-- Dialect -->
      <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
      <!-- Connection String -->
      <property name="connection.connection_string">my connection string</property>
      <!-- for debug purposes -->
      <property name="show_sql">true</property>
      <!-- Enables outer join fetching -->
      <property name="use_outer_join">false</property>
      <!-- Substitutions -->
      <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
      <!-- mapping files -->
      <mapping resource="myNamespace.myClass.hbm.xml" assembly="MyAssembly.dll" />
   </session-factory>
</hibernate-configuration>


And here is the mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="myNamespace" assembly="myAssembly.dll" >
   <class name="myClass" table="myTable">
      <id name="Id" column="Id" type="System.Guid">
         <generator class="guid" />
      </id>
                <!-- and the other columns -->
   </class>
</hibernate-mapping>


What I get is the error message: "File Not Found: myAssembly.dll"

If I delete the mapping line from the cfg file and try to load it manually then I get an error: "Persistent class: MyClass not found."

I believe that these errors occure because the main application is started from the application directory and myAssembly.dll is located in the "Extensions" subdirectory.

Any solutions? Can I set the assembly path related to the main application directory somehow in these config files?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.