开发者

select statement in hibernate criteria

I want to make the below query in hibernate criteria

开发者_运维百科

SELECT * FROM ORDERS O, PRODUCT P WHERE O.ORDER_ID=P.ORDER_ID and order.orderName='xyz';

thanks for your help


Please try below:

List orders = sess.createCriteria(Order.class)
    .createCriteria("products", "product")
        .add( Restrictions.eq("orderName", "xyz") )
    .setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP)
    .list();

Hope that helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜