bosh wrote:
I am having problems writing a query using the Expression class.
What i need to to return a list of 'DirectoryEntry' who have a relationship with a 'Tow' of a certain id. I dont understand how to query each Directory Entry's set of Tows?
First, don't use Expression class, see its javadoc :
Code:
/**
* This class is semi-deprecated. Use <tt>Restrictions</tt>.
*
* @see Restrictions
* @author Gavin King
*/
So, use
Restrictions instead.
Then, with HQL, you must "think" object. So, you should not use columns, but property names.
Your HQL query would look like :
<query name="Two.GetAll">from Tow t where t.Towid > 1 order by t.TowDesc</query>
Hey, I just noticed I'm in the NHibernate forum. Maybe what I just said is not completely true, I use Hibernate :-).