Hi everyone,
        I have an object named EntiteAffaire that has a collection (many-to-many relation with a composite-element) of coordinate. A coordinate can be a telephone, an address or an email. In the coordinate table, there is a field named "KIND_COO" that tells me which kind of coordinate is in the current row. Is it possible to specify a where clause for the set named entiteCoordonnees to get only one kind of coordinate in the set? This way, I would be able to defined three sets, one for each kind of coordinate. I succeed to specify a where clause that map to a field of the collection table (utl.t_entite_coordonnee_l), but not to the coordinate table, which is the end point of the relation.

        <class name="com.iris.business.component.util.EntiteAffaire" schema="UTL" table="T_ENTITE_AFFAIRE">
                <id name="id" type="string" column="ID_EA" unsaved-value="null">
                        <generator class="com.iris.infrastructure.services.identification.UniqueIDProviderHibernateImpl"/>

                </id>

                <set name="entiteCoordonnees" schema="UTL" table="T_ENTITE_COORDONNEE_L" lazy="true" cascade="all" >
                        <key column="ID_EA"/>
                       
                        <composite-element class="com.iris.business.component.util.EntiteCoordonnee">
                                <property name="utilisation" column="REF_UTIL_COORD_EC" type="string" not-null="true"/>
                                <many-to-one name="coordonnee"
                                                         column="ID_COO"
                                                         class="com.iris.business.component.util.CoordonneeUtil"
                                                         not-null="true" 
                                                         cascade="all"/>
                        </composite-element>
                </set>
        </class>

SQL> desc utl.t_entite_affaire;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID_EA                                     NOT NULL NUMBER(28)
 DATE_DERNIERE_MAJ                         NOT NULL TIMESTAMP(6)

SQL> desc utl.t_entite_coordonnee_l;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID_COO                                    NOT NULL NUMBER(28)
 ID_EA                                     NOT NULL NUMBER(28)
 REF_UTIL_COORD_EC                         NOT NULL VARCHAR2(19)
 DATE_DERNIERE_MAJ                         NOT NULL TIMESTAMP(6)

SQL> desc utl.t_coordonnee;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID_COO                                    NOT NULL NUMBER(28)
 KIND_COO                             NOT NULL VARCHAR2(19)
 DATE_DERNIERE_MAJ                         NOT NULL TIMESTAMP(6)

I hope that my question is clear enough...

Philip St-Pierre
Loto-Québec - Projet IRIS (Centre de livraison)
Analyste-Programmeur
+ [EMAIL PROTECTED]


Reply via email to