-->
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: Trying to Map using external class
PostPosted: Fri Jun 04, 2010 1:27 pm 
Newbie

Joined: Mon Feb 09, 2009 11:52 am
Posts: 11
So I have 2 projects a core project and a data access project. I would like to have all my NHibernate files in the Data Access project (Mapping, Config, Session management) but I would like all the classes I use to map in the core project. Currently I did this and now I am getting an exception...
Quote:
NHibernate.MappingException: persistent class AutomatedGrantSuggestions.Core.Organization, AutomatedGrantSuggestions.Core not found ---> System.IO.FileNotFoundException: Could not load file or assembly 'AutomatedGrantSuggestions.Core' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.


Am I missing something? Am I supposed to use external or something?

Here is the mapping file...
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
   auto-import="true">
  <class name="AutomatedGrantSuggestions.Core.Organization, AutomatedGrantSuggestions.Core" lazy="false" table="ct_org_master">
    <id name="CtId" column="ct_id">
      <generator class="native" />
    </id>
    <property name="Name" column="ct_org_name1"/>
    <property name="Name2" column="ct_org_name2"/>
    <bag name="AddressList" inverse="true" generic="true" lazy="true">
      <key>
        <column name="ct_Id" />
      </key>
      <one-to-many class="AutomatedGrantSuggestions.Core.Address, AutomatedGrantSuggestions.Core" not-found="ignore"/>
    </bag>
  </class>
  <class name="AutomatedGrantSuggestions.Core.Address, AutomatedGrantSuggestions.Core" lazy="false" table="ct_org_address">
    <composite-id>
      <key-property name="CtId" column="ct_id" />
      <key-property name="Type" column="ct_org_addr_type"/>
    </composite-id>
    <property name="Line1" column="ct_org_addr1"/>
    <property name="Line2" column="ct_org_addr2"/>
    <!--<many-to-one name="CtId" not-null="false"/>-->
  </class>
  <class name="AutomatedGrantSuggestions.Core.GrantMaster, AutomatedGrantSuggestions.Core" table="gt_master" lazy="false">
    <id name="Id" column="gt_id">
      <generator class="native" />
    </id>
    <property name="OrganizationId" column="ct_id"/>
    <property name="OrganizationName" column="gt_org_name1"/>
    <property name="OrganizationAddressLine1" column="gt_org_addr1"/>
    <property name="OrganizationAddressLine2" column="gt_org_addr2"/>
    <property name="OrganizationPhone" column="gt_org_phone"/>
    <property name="OrganizationCity" column="gt_org_city"/>
    <!--<property name="OrganizationContact" column="ct_org_"/>-->
    <property name="OrganizationState" column="gt_org_state"/>
    <property name="OrganizationZipCode" column="gt_org_zip"/>
    <property name="RequestedAmount" column="gt_request_amt"/>
    <property name="SpecialInstructions" column="gt_special_instructions"/>
    <!--<property name="SpecialType" column="ct_org_name2"/>
    <property name="SpecialTypeName" column="ct_org_name2"/>-->
  </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: Re: Trying to Map using external class
PostPosted: Fri Jun 04, 2010 1:30 pm 
Newbie

Joined: Mon Feb 09, 2009 11:52 am
Posts: 11
Tried to rebuild project and now I am getting...
Quote:
------ Test started: Assembly: AutomatedGrantSuggestions.DataAccess.Tests.dll ------

Test 'AutomatedGrantSuggestions.Core.Tests.GrantMasterIntegrationTest.TestRetrieveHibernateFromID' failed: Test method AutomatedGrantSuggestions.Core.Tests.GrantMasterIntegrationTest.TestRetrieveHibernateFromID threw exception: NHibernate.MappingException: Could not compile the mapping document: AutomatedGrantSuggestions.Core.Mapping.hbm.xml ---> NHibernate.MappingException: persistent class AutomatedGrantSuggestions.Core.Organization, AutomatedGrantSuggestions.Core not found ---> System.IO.FileNotFoundException: Could not load file or assembly 'AutomatedGrantSuggestions.Core' or one of its dependencies. The system cannot find the file specified.=== Pre-bind state information ===
LOG: User = Jackie-VPC\Jackie
LOG: DisplayName = AutomatedGrantSuggestions.Core
(Partial)
LOG: Appbase = file:///C:/Users/Jackie/Desktop/jgleason_gss/trunk/AutomatedGrantSuggestions.DataAccess.Tests/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Jackie\AppData\Local\Temp\tmpD2D5.tmp
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
.
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
at NHibernate.Util.ReflectHelper.ClassForName(String name)
at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- End of inner exception stack trace ---
at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForNameChecked(String name, Mappings mappings, String errorMessage)
at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindClass(XmlNode node, IDecoratable classMapping, PersistentClass model, IDictionary`2 inheritedMetas)
at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(XmlNode node, HbmClass classSchema, IDictionary`2 inheritedMetas)
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses(XmlNode parentNode, IDictionary`2 inheritedMetas)
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode node)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document)
at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
Classes\HibernateUtils.cs(98,0): at AutomatedGrantSuggestions.DataAccess.HibernateUtils.OpenSession()
Classes\HibernateUtils.cs(34,0): at AutomatedGrantSuggestions.DataAccess.HibernateUtils.getGrant(String grantId)
GrantMasterIntegrationTest.cs(20,0): at AutomatedGrantSuggestions.Core.Tests.GrantMasterIntegrationTest.TestRetrieveHibernateFromID()

Test 'AutomatedGrantSuggestions.Core.Tests.GrantMasterIntegrationTest.TestAddHibernateFromExisting' failed: Test method AutomatedGrantSuggestions.Core.Tests.GrantMasterIntegrationTest.TestAddHibernateFromExisting threw exception: NHibernate.MappingException: Could not compile the mapping document: AutomatedGrantSuggestions.Core.Mapping.hbm.xml ---> NHibernate.MappingException: persistent class AutomatedGrantSuggestions.Core.Organization, AutomatedGrantSuggestions.Core not found ---> System.IO.FileNotFoundException: Could not load file or assembly 'AutomatedGrantSuggestions.Core' or one of its dependencies. The system cannot find the file specified.=== Pre-bind state information ===
LOG: User = Jackie-VPC\Jackie
LOG: DisplayName = AutomatedGrantSuggestions.Core
(Partial)
LOG: Appbase = file:///C:/Users/Jackie/Desktop/jgleason_gss/trunk/AutomatedGrantSuggestions.DataAccess.Tests/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Jackie\AppData\Local\Temp\tmpD2D5.tmp
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
.
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
at NHibernate.Util.ReflectHelper.ClassForName(String name)
at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- End of inner exception stack trace ---
at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
at NHibernate.Cfg.XmlHbmBinding.Binder.ClassForNameChecked(String name, Mappings mappings, String errorMessage)
at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindClass(XmlNode node, IDecoratable classMapping, PersistentClass model, IDictionary`2 inheritedMetas)
at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(XmlNode node, HbmClass classSchema, IDictionary`2 inheritedMetas)
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses(XmlNode parentNode, IDictionary`2 inheritedMetas)
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode node)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document)
at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
Classes\HibernateUtils.cs(98,0): at AutomatedGrantSuggestions.DataAccess.HibernateUtils.OpenSession()
Classes\HibernateUtils.cs(34,0): at AutomatedGrantSuggestions.DataAccess.HibernateUtils.getGrant(String grantId)
GrantMasterIntegrationTest.cs(26,0): at AutomatedGrantSuggestions.Core.Tests.GrantMasterIntegrationTest.TestAddHibernateFromExisting()

0 passed, 2 failed, 0 skipped, took 15.68 seconds (MSTest 9.0).



This all worked before I moved the project :-(


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.