Or condition with on clause with join in JPA 2.0

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.

The join condition you are seeing is due to the way you defined your association. You can only get rid of that if you avoid the association join and instead use a cross join like this:

Root<GroupProduct> groupProduct = query.from(GroupProduct.class);
Predicate p1=criteriaBuilder.equal(groupProduct.get("parentProduct"), joinGroupProduct.get("product"));
Predicate p2=criteriaBuilder.equal(groupProduct.get("productId"), joinGroupProduct.get("product"));
query.where(criteriaBuilder.or(p1, p2));