| hi everyone,I am new in nhibernate and I want use join in a one-to-many(customer--order) relation:
 ---
 ISession vSession= NHibernateSessionManager.Instance.GetSession();
 string hql="from Customer c,Order o where c.customerID=o.customerID";
 vSession.CreateQuery(hql).List<object[]>();
 ---
 
 <?xml version="1.0" encoding="utf-8" ?>
 <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
 <class name="BasicSample.Core.Domain.Customer, BasicSample.Core" table="Customers">
 <id name="ID" column="CustomerID">
 <generator class="identity" />
 </id>
 
 <property name="CompanyName" column="CompanyName" />
 <property name="ContactName" column="ContactName" />
 
 <bag name="Orders" table="Orders" inverse="true">
 <key column="CustomerID" />
 <one-to-many class="BasicSample.Core.Domain.Order, BasicSample.Core" />
 </bag>
 </class>
 </hibernate-mapping>
 <?xml version="1.0" encoding="utf-8" ?>
 <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
 <class name="BasicSample.Core.Domain.Order, BasicSample.Core" table="Orders" >
 <id name="ID" column="OrderID" unsaved-value="0">
 <generator class="identity" />
 </id>
 
 <property name="OrderDate" column="OrderDate" />
 <property name="ShipToName" column="ShipName" />
 
 <many-to-one name="OrderedBy" column="CustomerID"
 class="BasicSample.Core.Domain.Customer, BasicSample.Core" not-null="true" />
 </class>
 </hibernate-mapping>
 ---and the error is "NHibernate.QueryException : could not resolve property", when i chang the hql to "from Customer ,Order " it works fine.
 
 How did this happen and how can i use join in hql? can someone help me? Thank you.
 
 
 |