Hi Dries,

If I understand correctly, you have the following relations:

Machine <-> Product is one to many
Product <-> Material is many to one

So you can use

SELECT OBJECT (p)
FROM product p
WHERE p.material = ?1 AND p.machine = ?2

to get a collection of all products of the specified material on a
specified machine.

Hope this helps,
Dies


Dries wrote:
>
> Hello,
>
> Say you have this situation: 3 CMP beans: Machine, Product and Material.
> A Product is made on a machine and on one machine, many products can be produced.
> Each product is made of 1 material but 1 material can be used for many products.
>
> What I want to do is select all the product that are produced on a machine and with 
>a particular material.
> I could do it with a finderMethod in the MAchineBean to retreive all the products 
>for the machine. And than iterated over all those products and check the material 
>using the CMR method getMaterial.
> Instead of using the getMaterial CMR method I could define a findByMaterial method 
>in the product bean which gives me all the products made with the given material.
> And then iterate over the 2 Collections to find out which product occur in both 
>Collections.
>
> But I wonder if there is a way to define only one finder or ejbSelect method that 
>gives me the result directly?
>
> Can somebody give me some information on this?
>
> Kind regards,
>
> Dries
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to