Hi Reddy,
You want just "Product" not "primaryProducts". getRelated expects the name of the related entity. One way of finding related entities is to look in the Web Tools. For example, see
https://demo-trunk.ofbiz.apache.org/webtools/control/ViewRelations?entityName=ProductCategory(or the equivalent in your own deployment of Ofbiz) for the exact names of the entities related to ProductCategory.
Cheers
Paul Foxworthy
reddyraja86 wrote
Hi All,
I am new to ofbiz ,I have a requirement where i am retrieving Products and product categories , i have product category id.I can get the ProductCategory details but i am not able to retrieve the Product details.(Productcategory and Product are two entities they have one to many relation)
My Code is
GenericDelegator delegator = (GenericDelegator) DelegatorFactory.getDelegator("default");
GenericValue agreementItems=delegator.findByPrimaryKeyCache("ProductCategory", UtilMisc.toMap("productCategoryId", request.getParameter("id")));
System.out.println( agreementItems.getString("categoryName"));
But i am not able to get the product details
List l=(List)agreementItems.getRelatedCache("primaryProducts");
can anyone help me.