I think I was half asleep when I wrote these... The following code should work:

   int iCategoryId = Integer.parseInt(categoryId);
   Criteria prodcrit = new Criteria();

   prodcrit.add(ProductInCategoryPeer.PROD_ID, 0, Criteria.GREATER_THAN);
   if (iCategoryId != 0)  {
        prodcrit.add(ProductInCategoryPeer.CAT_ID, iCategoryId);
   }
   prodcrit.addJoin(ProductInCategoryPeer.PROD_ID, ProductPeer.ID);
   prodcrit.addJoin(ProductInCategoryPeer.CAT_ID, CategoryPeer.ID);

   prodcrit.addAscendingOrderByColumn(ProductPeer.PRODUCT_NAME);
   prodcrit.setDistict();

   return ProductPeer.doSelect(prodcrit);

Good luck and sorry for the previous mistake,
Antonis

[EMAIL PROTECTED] wrote:

Sven Richter <[EMAIL PROTECTED]> wrote:

...
       if (iCategoryId != 0)

       {

           prodcrit.add(ProductInCategoryPeer.CAT_ID, iCategoryId);

the method you need is "addJoin" and not "add".

       }

       prodcrit.addAscendingOrderByColumn(ProductPeer.PRODUCT_NAME);

       prodcrit.setDistinct();


...

Thanks a lot,
Sven.


Good luck,
Antonis


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to