Can anyone help to create join clause like below:
inner join group_products groupprodu2_ on
product1_.product_id = groupprodu2_.product_id
or product1_.parent_product_id = groupprodu2_.product_id
Here I need or condition with on clause. I am using below code but it is creating the default on clause which I want to override:
Java Code-
Join<Product, GroupProduct> joinGroupProduct = joinCategoryProduct.join(“groupProduct”);
Predicate p1=criteriaBuilder.equal(joinCategoryProduct.get(“parentProduct”), joinGroupProduct.get(“product”));
Predicate p2=criteriaBuilder.equal(joinCategoryProduct.get(“productId”), joinGroupProduct.get(“product”));
joinGroupProduct.on(criteriaBuilder.or(p1, p2));
Query Created-
inner join group_products groupprodu2_ on
product1_.product_id = groupprodu2_.product_id
and (product1_.parent_product_id = groupprodu2_.product_id
or product1_.product_id = groupprodu2_.product_id)
In the above query I don’t need the condition in bold one, please suggest.