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
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