开发者

DetachedCriteria equivalent needed

开发者 https://www.devze.com 2023-02-11 11:25 出处:网络
开发者_如何学运维I need the DetachedCriteria equivalent to the following HQL: select obj from Objects obj, Text text
开发者_如何学运维

I need the DetachedCriteria equivalent to the following HQL:

select obj
from Objects obj, Text text
where obj.TextId = text.TextId and <Some_Other_Condition>
order by text.Value

Thanx


It's all depending of your Mapped objects

Here is an example:

    var criteriaObject = DetachedCriteria.For(typeof(Objects))
        .CreateAlias("TextReference", "text")
        .Add(Restrictions.Eq("Activate", true))
        .AddOrder(new Order("text.Value", true));

Hope it helps

0

精彩评论

暂无评论...
验证码 换一张
取 消