-->
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.  [ 3 posts ] 
Author Message
 Post subject: Could not compile the mapping document
PostPosted: Sat Aug 21, 2010 10:26 pm 
Newbie

Joined: Sat Aug 21, 2010 9:36 pm
Posts: 2
I am sure you get this kind of questions a lot, but here it goes...
No matter what i do, i get the same exception-

Could not compile the mapping document: Host.Mappings.ProductClss.hbm.xml

at this line-

Configuration conf = new Configuration().Configure();

I have a silverlight app, and console app called Host which i'm planning to use to manage data from oracle database.
The assembly name for console app is also Host, and namespace as well. All .xml files are embeded resources.

xml mapping for product class:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Host"  namespace="Host" >
  <class name="Host.Classes.ProductClss,Host"  table="product">
    <id name="productId" column="productId" type="Int32" unsaved-value="0">
      <generator class="increment"></generator>
    </id>
    <property name="productName" column="productName" type="string" length="50" not-null="true"/>
    <property name="productDescription" column="productDescription" type="string" length="200" not-null="false"/>
    <property name="author" column="author" type="string" length="50" not-null="true"/>
    <property name="weight" column="weight" type="Int32" not-null="true"/>
    <property name="price" column="price" type="decimal" not-null="true"/>
    <property name="availableQuantity" column="availableQuantity" type="Int32" not-null="true"/>   
    <bag name="pictures" inverse="true" cascade="all-delete-orphan">
      <key column="pictureId"/>
      <one-to-many class="Host.Classes.PictureClss,Host"/>
    </bag>
    <bag name="cartItems" inverse="true" cascade="all-delete-orphan">
      <key column="cartItemId"/>
      <one-to-many class="Host.Classes.CartItemClss,Host"/>
    </bag>
    <bag name="orderItems" inverse="true" cascade="all-delete-orphan">
      <key column="orderItemId"/>
      <one-to-many class="Host.Classes.OrderItemClss,Host"/>
    </bag>
    <bag name="groups" table="groupProduct" cascade="none">
      <key>
        <column name="productId" not-null="true"/>
      </key>
      <many-to-many class="Host.Classes.GroupClss,Host">
        <column name="groupId" not-null="true"/>       
      </many-to-many>
    </bag>
  </class>
</hibernate-mapping>


ProductClss.cs:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Host
{
    public class ProductClss
    {
        private int _productId;
        private string _productName;
        private string _productDescription;
        private string _author;
        private decimal _price;
        private int _weight;
        private int _availableQuantity;
        private IList<PictureClss> _pictures;
        private IList<CartItemClss> _cartItems;
        private IList<OrderItemClss> _orderItems;
        private IList<GroupClss> _groups;

        #region properties

        public virtual int productId
        {
            get { return _productId;}
            set { _productId = value;}
        }
        public virtual string productName
        {
            get { return _productName;}
            set { _productName = value;}
        }
        public virtual string productDescription
        {
            get { return _productDescription;}
            set { _productDescription = value;}
        }
        public virtual string author
        {
            get { return _author;}
            set { _author = value;}
        }
        public virtual int weight
        {
            get { return _weight;}
            set { _weight= value;}
        }
        public virtual decimal price
        {
            get { return _price;}
            set { _price = value;}
        }
        public virtual int availableQuantity
        {
            get { return _availableQuantity;}
            set { _availableQuantity = value;}
        }
        public virtual IList<PictureClss> pictures
        {
            get { return _pictures; }
            set { _pictures = value; }
        }
        public virtual IList<CartItemClss> cartItems
        {
            get { return _cartItems; }
            set { _cartItems = value; }
        }
        public virtual IList<OrderItemClss> orderItems
        {
            get { return _orderItems; }
            set { _orderItems = value; }
        }
        public virtual IList<GroupClss> groups
        {
            get { return _groups; }
            set { _groups = value; }
        }

        #endregion
    }
}


and picture of the part of physical model related to Product and its relations


Image


I looked for a bunch of examples of mapping but i can't find the error.
The application is throwing an exception in console, so i cannot see inner exception details.
I'm quite new at this, so any help is welcome...
Thanks


Top
 Profile  
 
 Post subject: Re: Could not compile the mapping document
PostPosted: Mon Aug 23, 2010 3:12 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Is there an InnerException with a better error message ? Normally there should be one ...

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: Re: Could not compile the mapping document
PostPosted: Mon Aug 23, 2010 5:51 am 
Newbie

Joined: Sat Aug 21, 2010 9:36 pm
Posts: 2
i've found what the problem was. i didn't make a folder with all dlls, i only added nhibernate.dll. because it only needs direct reference to it, but nhibernate is using the other ones as well. Now everything works...
ah.. i was convinced that i did something wrong with mapping files or configuration, so i looked at the same files for 2 days and found nothing. :) some tutorial for beginners helped. :)

thank you wolli for the reply!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.