Change the 3rd line of code (in the top section of my pseudo code) to

crit.add(productGroupPeer.group_name, "widgets", Crieteria.NOT_EQUAL);

Am I still missing the jist of your question?

Steve B.

----- Original Message -----
From: "Rooms, Christoph" <[EMAIL PROTECTED]>
To: "'Turbine Torque Users List'" <[EMAIL PROTECTED]>
Sent: Sunday, June 16, 2002 1:29 PM
Subject: RE: How to do this ...


> Thanks Steve,
>
> My question is more pointed to how to get a list of all the products that
> are NOT connected to a certain group.
>
> I managed to solve it to first get a List with all the products of a
certain
> group. And then to this.
>
> // code to get a Vector with all product_id's
> crit.add(productPeer.product_id, "widgets");
> crit.addNotIn(productPeer.product_id, vector_with_product_ids)
> Vector v = product.doSelect( crit );
>
> Anyone has got another way to do this or ist this the best way
>
> -----Original Message-----
> From: sbelt [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 14, 2002 8:57 PM
> To: Turbine Torque Users List
> Subject: Re: How to do this ...
>
> I do this by creating a 3rd table which stores groups. For example
>
> table product:            table categoryList            table productGroup
> -----------------            --------------------            -------------
--
> -------
> product_id                    list_id                            group_id
> product_name               product_id                     group_name
> product_list_id             group_id
product_list_id
>
> (This is pseudo-code at best)
>
> To list all products for a group:
>
> crit.addJoin(productPeer.product_list_id, categoryListPeer.list_id);
> crit.addJoin(categoryListPeer.group_id, productGroupPeer.group_id);
> crit.add(productGroupPeer.group_name, "widgets");
> Vector v = product.doSelect( crit );
>
> To list all groups for a product:
> crit.addJoin(productGroupPeer.product_list_id, categoryListPeer.list_id);
> crit.addJoin(categoryListPeer.product_id, productPeer.product_id);
> crit.add(ProductPeer.product_name, "Spacely Sprocket");
> Vector v = productGroupPeer.doSelect( crit );
>
> I hope I didn't skip/confuse anything here, but I hope you get the
concept.
>
> Steve B.
>
> ----- Original Message -----
> From: "Rooms, Christoph" <[EMAIL PROTECTED]>
> To: "'Turbine Torque Users List'" <[EMAIL PROTECTED]>
> Sent: Friday, June 14, 2002 8:07 AM
> Subject: How to do this ...
>
>
> > Hi all,
> >
> > I am using Torque for a few days now and it ROCKS !
> >
> > Anyway ... How can I solve this using Criteria ?
> >
> > I have an n:m relation ship.
> >
> > Ex : product / productgroup and a product can be in multiple product
> groups,
> > and the other way around.
> >
> > Ok ... How can I get a list of all the products that are not connected
to
> > productgroup = "1"
> >
> > Is this done with the addNotIn ?
> >
> > Thanks, Christoph
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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

Reply via email to