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.
精彩评论