休眠。将HQL转换为Criteria API

时间:2010-03-19 16:18:27

标签: nhibernate hql criteria

如何将以下hql转换为Criteria API

var criteria = this.Session.CreateQuery("select m, m.Attachments.size from AdvanceMessage m");

? 感谢

1 个答案:

答案 0 :(得分:0)

你的问题有点模糊,但它是这样的:

IList<AdvanceMessage> list = session.CreateCriteria(typeof(AdvanceMessage))
    .List<AdvanceMessage>();