Hello,

I have the following three tables:

        *<table* name="CATEGORY" idMethod="native"*>*
                *<column* name="ID" required="true" primaryKey="true" autoIncrement="true" 
type="INTEGER"*/>*
                *<column* name="NAME" required="true" size="32" 
type="VARCHAR"*/>*
                *<column* name="DESCRIPTION" size="255" type="VARCHAR"*/>*
                *<unique* name="CATEGORY_UNIQUE"*>*
                        *<unique-column* name="NAME"*/>*
                *</unique>*
                *<index* name="CATEGORY_INDEX"*>*
                        *<index-column* name="NAME"*/>*
                *</index>*
        *</table>*

        *<table* name="PRODUCT" idMethod="native"*>*
                *<column* name="ID" required="true" primaryKey="true" autoIncrement="true" 
type="INTEGER"*/>*
                *<column* name="PRODUCT_NAME" required="true" size="32" 
type="VARCHAR"*/>*
                *<column* name="DESCRIPTION" size="255" type="VARCHAR"*/>*
                *<column* name="PRICE" required="true" type="DOUBLE" 
size="10,2"*/>*
        *</table>*
        
        *<table* name="PRODUCT_IN_CATEGORY" idMethod="native"*>*
*<column* name="ID" required="true" primaryKey="true" autoIncrement="true" type="INTEGER"*/>* /<!-- Produkt-ID -->/
                *<column* name="PROD_ID" required="true" type="INTEGER"*/>*
                /<!-- Category-ID des Produkts-->/
                *<column* name="CAT_ID" required="true" type="INTEGER"*/>*
                *<foreign-key* foreignTable="PRODUCT"*>*
                        *<reference* local="PROD_ID" foreign="ID"*/>*
                *</foreign-key>*
                *<foreign-key* foreignTable="CATEGORY"*>*
                        *<reference* local="CAT_ID" foreign="ID"*/>*
                *</foreign-key>*
        *</table>*


In the table 'PRODUCT' I store the data for the product, except for the Category. That data is stored in an extra table called 'PRODUCT_IN_CATEGORY', that has a foreign key for the ID in the 'PRODUCT' table and one for the ID in the 'CATEGORY' table. The reason for that is, that I want to be able to assign a product to more than one category. Everything works just fine, except for the fact, that when I don't specify a certain category in the java class that is responsable for returning the products by reading them from the database, the products that are in more than one category, are returned several times (e.g. when a product is in two categories, the same product is returned twice). According to the Torque manual, there is an option 'setDistinct()' that is supposed to prevent that. But it somehow does work.

Does anybody know, what I can do?

Thanks a lot,
Sven.


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

Reply via email to