I have domain class location
public abstract class BaseEntity<T> where T: struct
{
public virtual T Id { get; set; }
public virtual bool Equals(BaseEntity<T> other)
}
public class Location : BaseEntity<Int32>
{
public User User {get;set;}
}
public class User : BaseEntity<Int32>
{
public string Name {get;set;
}
public OtherInfo Otherinfo {get;set;};
}
public class OtherInfo
{
public string preference {get;set;};
}
var criteria = session.CreateCriteria(typeof(Location), "alias");
criteria.CreateCriteria("User", "user", JoinType.InnerJoin);
criteria.CreateCriteria("user.Otherinfo", "userInfo",JoinType.InnerJoin);
criteria.Add(Restrictions.Eq("user.Id", 100));
criteria.SetProjection(Projections.Alias(Projections.Id(), "Id"), Projections.Alias(Projections.Property("user.Name"), "Name"), Projections.Alias(Projections.Property("userInfo.preference "), "pref"));
now when i execute above criteria, it gives error on userInfo.preference. {NHibernate.QueryException: could not resolve property: Otherinfo of: Location.User What is mistake here. is it because of multi nested objects