IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

Besoin d'un objet dans plusieurs listes


Sujet :

Hibernate Java

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2011
    Messages : 7
    Points : 9
    Points
    9
    Par défaut Besoin d'un objet dans plusieurs listes
    Bonjour,

    J'ai une classe "Entreprise" qui possède des secteurs d'application mais aussi d'activité.

    Ces secteurs sont représentés par des listes d'objets "Secteur" dans l'objet "Entreprise". De plus, ils ont les mêmes valeurs (2 fois la même liste de choix sectoriel).

    D'un point de vue DB, j'ai une table "entreprise", "secteur" et deux tables relations "rel_ent_sect_app" et "rel_ent_sect_act" qui ne possède que les clés primaire des deux tables liées.

    Mon problème est donc le suivant, lorsque l'on modifie les données d'une entreprise, celle-ci peut contenir deux fois un même objet "Secteur" (un pour les secteurs d'application et l'autre pour les secteurs d'activité). Le soucis, c'est que quand hibernate doit tout mettre à jour, il lance l'exception "NonUniqueObjectException" étant donné que j'ai deux fois le même objet "Secteur" (même id).

    J'ai vu qu'il y avait quelques sujets similaires sur le forum mais ceux-ci ne m'aident pas vraiment. Généralement, la fonction "saveOrUpdate()" qui est montrée dans leur topic est spécifique à l'objet à sauver. Moi, tout mes objets appellent la même fonction. Je ne peux donc pas la rendre trop spécifique à un type d'objet.

    Je pensais, le cas échéant, à créer deux classes distinctes. Une serait "SecteurActivite" et l'autre "SecteurApplication" mais étant donné que ces classe aurait vraiment les même informations, je ne ferait cela qu'en dernier recours.


    Si quelqu'un a une idée pour résoudre le problème je suis preneur.

  2. #2
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    As-tu codé les méthodes hashCode et equals ?
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2011
    Messages : 7
    Points : 9
    Points
    9
    Par défaut
    Oui mais justement, ces fonctions indiquent que les 2 objets ont le même ID (ce qui est logique).

  4. #4
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Peux-tu montrer le mapping des entités ?
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  5. #5
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2011
    Messages : 7
    Points : 9
    Points
    9
    Par défaut
    Voici le mapping de la classe "Entreprise":

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
         Attention: Generated code! Do not modify by hand!
         Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
      -->
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
              "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
     
    <hibernate-mapping default-cascade="save-update">
        <class name="be.awex.renew.business.objects.Entreprise" table="ENTREPRISE" dynamic-insert="false" dynamic-update="false">
            <id name="id" type="long" unsaved-value="null">
                <column name="IDENT" sql-type="NUMBER(19)"/>
                <generator class="sequence">
                    <param name="sequence">ENTREPRISE_SEQ</param>
                </generator>
            </id>
            <property name="deleted" type="boolean">
                <column name="DELETED" not-null="false" unique="false" />
            </property>
            <property name="raisoc" type="java.lang.String">
                <column name="RAISOC" not-null="false" unique="false" />
            </property>
            <property name="abrev" type="java.lang.String">
                <column name="ABREV" not-null="false" unique="false" />
            </property>
            <property name="fax" type="java.lang.String">
                <column name="FAX" not-null="false" unique="false" />
            </property>
            <property name="phoneNumber" type="java.lang.String">
                <column name="TEL" not-null="false" unique="false" />
            </property>
           <property name="modificationDate" type="java.util.Date">
                <column name="DATMAJ" not-null="false" unique="false" />
            </property>
            <property name="suspensionDate" type="java.util.Date">
                <column name="DATE_CESSATION" not-null="false" unique="false" />
            </property>
            <property name="creationDate" type="java.util.Date">
                <column name="DATE_CREATION_FICHE" not-null="false" unique="false" />
            </property>
     
            <property name="enterpriseCreationDate" type="java.util.Date">
                <column name="DATCRE" not-null="false" unique="false" />
            </property>
            <property name="createdBy" type="java.lang.String">
                <column name="CREE_PAR" not-null="false" unique="false" />
            </property>
            <property name="modifiedBy" type="java.lang.String">
                <column name="MODIFIE_PAR" not-null="false" unique="false" />
            </property>
            <property name="regcomm" type="java.lang.String">
                <column name="REGCOMM" not-null="false" unique="false" />
            </property>
            <property name="mobilePhone" type="java.lang.String">
                <column name="GSM" not-null="false" unique="false" />
            </property>
            <property name="url" type="java.lang.String">
                <column name="URL" not-null="false" unique="false" />
            </property>
            <property name="email" type="java.lang.String">
                <column name="EMAIL" not-null="false" unique="false" />
            </property>
            <property name="enterpriseNumber" type="java.lang.String">
                <column name="NUMENT" not-null="false" unique="false" />
            </property>
            <property name="version" type="java.lang.Long">
                <column name="VERSION" not-null="false" unique="false" />
            </property>
            <property name="actionAttente" type="java.lang.String">
                <column name="ACTION_ATTENTE" not-null="false" unique="false" />
            </property>
            <property name="street" type="java.lang.String">
                <column name="RUE" not-null="false" unique="false" />
            </property>
            <property name="streetNumber" type="java.lang.String">
                <column name="NUMRUE" not-null="false" unique="false" />
            </property>
            <property name="POBox" type="java.lang.String">
                <column name="BOITEPOS" not-null="false" unique="false" />
            </property>
            <property name="certificate" type="java.lang.String">
                <column name="CERTIF" not-null="false" unique="false" />
            </property>
            <property name="award" type="java.lang.String">
                <column name="AWARD" not-null="false" unique="false" />
            </property>
            <property name="brand" type="java.lang.String">
                <column name="MARQUE" not-null="false" unique="false" />
            </property>
            <property name="patent" type="java.lang.String">
                <column name="BREVET" not-null="false" unique="false" />
            </property>
            <property name="communicationAuCr" type="java.lang.String">
                <column name="COMMUNICATION_CR" not-null="false" unique="false" />
            </property>
            <many-to-one name="enterpriseType" class="be.awex.renew.business.objects.journal.EnterpriseType" fetch="select" lazy="true">
                <column name="IDT_ENT" not-null="false"/>
            </many-to-one>
            <property name="flag_obce" type="boolean">
                <column name="FLAG_OBCE" not-null="false" unique="false" />
            </property>
             <property name="mobilePhoneOwner" type="java.lang.String">
                <column name="GSM_PROPRIETAIRE" not-null="false" unique="false" />
            </property>
            <property name="treatingAgent" type="java.lang.String">
                <column name="ID_AGENTTRAITANT" not-null="false" unique="false" />
            </property>
            <property name="bankAccount" type="java.lang.String">
                <column name="CPT_BANQUAIRE" not-null="false" unique="false" />
            </property>
            <property name="iban" type="java.lang.String">
                <column name="IBAN" not-null="false" unique="false" />
            </property>
            <property name="bic" type="java.lang.String">
                <column name="BIC" not-null="false" unique="false" />
            </property>
            <property name="pme" type="boolean">
                <column name="PME" not-null="false" unique="false" />
            </property>
            <property name="pmeReferenceDate" type="java.lang.String">
                <column name="PME_DATE_REFERENCE" not-null="false" unique="false" />
            </property>
            <property name="infoExclusion" type="boolean">
                <column name="EXCLU_INFO" not-null="false" unique="false" />
            </property>
            <property name="oppoExclusion" type="boolean">
                <column name="EXCLU_OPPO" not-null="false" unique="false" />
            </property>
            <property name="foreignInvestment" type="boolean">
                <column name="INVEST_ETRANGER" not-null="false" unique="false" />
            </property>
            <property name="inquiryExclusion" type="boolean">
                <column name="EXCLU_ENQUETE" not-null="false" unique="false" />
            </property>
            <property name="mailingExclusion" type="boolean">
                <column name="EXCLU_MAILING" not-null="false" unique="false" />
            </property>
            <property name="marketExclusion" type="boolean">
                <column name="EXCLU_MARCHE" not-null="false" unique="false" />
            </property>
            <property name="sectorExclusion" type="boolean">
                <column name="EXCLU_SECTEUR" not-null="false" unique="false" />
            </property>
             <property name="organisationInfoExclusion" type="boolean">
                <column name="EXCLU_INFO_ORG" not-null="false" unique="false" />
            </property>
            <property name="activite" type="clob">
                <column name="ACTIVITE" not-null="false" unique="false" />
            </property>
            <property name="memo" type="java.lang.String">
                <column name="MEMO" not-null="false" unique="false" />
            </property>
            <property name="groupOwner" type="java.lang.String">
                <column name="LIBELLE_GROUPE" not-null="false" unique="false" />
            </property>
            <property name="zipCode" type="java.lang.Long">
                <column name="IDCODEPOS" not-null="false" unique="false" />
            </property>
            <property name="deletionDate" type="java.util.Date">
                <column name="DATE_SUPPRESSION" not-null="false" unique="false" />
            </property>
            <property name="minimis" type="int">
                <column name="MINIMIS" not-null="false" unique="false" />
            </property>
            <property name="establishmentNumber" type="java.lang.Long">
                <column name="NUMETAB" not-null="false" unique="false" sql-type="NUMBER(19)"/>
            </property>
            <property name="streetContact" type="java.lang.String">
                <column name="RUE_CONTACT" not-null="false" unique="false" />
            </property>
            <property name="streetNumberContact" type="java.lang.String">
                <column name="NUMRUE_CONTACT" not-null="false" unique="false" />
            </property>
            <property name="POBoxContact" type="java.lang.String">
                <column name="BOITEPOS_CONTACT" not-null="false" unique="false" />
            </property>   
             <property name="zipCodeContact" type="java.lang.Long">
                <column name="IDCODPOS_CONTACT" not-null="false" unique="false"/>
             </property>
     
            <property name="noteInterne" type="java.lang.String">
                <column name="NOTE_INTERNE" not-null="false" unique="false" />
            </property>
     
            <property name="copyIdent" type="java.lang.Long">
                <column name="COPIE_DE_IDENT" not-null="false" unique="false" />
            </property>
            <property name="copyDate" type="java.util.Date">
                <column name="DATE_COPIE" not-null="false" unique="false" />
            </property>
            <property name="recalcitrant" type="boolean">
                <column name="RECALCITRANT" not-null="false" unique="false" />
            </property>
            <property name="astData" type="java.lang.String">
                <column name="AST_DATA" not-null="false" unique="false" />
            </property>
     
            <set name="actions" table="REL_ENTREPRISE_ACTION" order-by="ACTIONS_FK" fetch="select" lazy="true" inverse="true" >
                <key foreign-key="ENTREPRISE_ENTREPRISES_FKC">
                    <column name="ENTREPRISES_FK" sql-type="NUMBER(19)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.Action" foreign-key="ACTION_ACTIONS_FKC">
                    <column name="ACTIONS_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>
            <set name="actentFilesses" table="REL_ACTENTFILES_ENTREPRISE" order-by="ACTENT_FILESSES_FK" fetch="select" lazy="true" inverse="false">
                <key foreign-key="ACTENT_FILES_ENTREPRISES_FKC">
                    <column name="ENTREPRISES_FK" sql-type="NUMBER(19)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.ActentFiles" foreign-key="ENTREPRISE_ACTENT_FILESSES_FKC">
                    <column name="ACTENT_FILESSES_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>
            <many-to-one name="oppoSurvey" class="be.awex.renew.business.objects.journal.OppoSurvey" fetch="select" foreign-key="ENTREPRISE_OPPO_SURVEY_FKC" lazy="true">
                <column name="OPPO_SURVEY_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <set name="formations" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true">
                <key foreign-key="FORMATION_ENTREPRISE_FKC">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.journal.Formation"/>
                <filter name="deletedFilter" condition=":deleted = DELETED"/>
            </set>
            <set name="informations" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true">
                <key foreign-key="INFORMATION_ENTREPRISE_FKC">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.journal.Information"/>
                <filter name="deletedFilter" condition=":deleted = DELETED"/>
            </set>
            <set name="incitants" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true">
                <key foreign-key="INCITANT_ENTREPRISE_FKC">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.journal.Incitant"/>
            </set>
            <set name="inscription_acts" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true">
                <key foreign-key="INSCRIPTION_ACT_ENTREPRISE_FKC">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.journal.Inscription_act"/>
            </set>
     
            <set name="applicationSecteurs" table="REL_ENT_SECT_APP" order-by="SECTEURS_FK" fetch="select" lazy="true" inverse="false">
                <key foreign-key="SECTEUR_APP_ENTREPRISES_FKC">
                    <column name="ENTREPRISES_FK" sql-type="NUMBER(19)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.Secteur" foreign-key="ENTREPRISE_SECTEURS_APP_FKC">
                    <column name="SECTEURS_FK"/>
                </many-to-many>
            </set>
     
            <set name="activiteSecteurs" table="REL_ENT_SECT_ACT" order-by="SECTEURS_FK" fetch="select" lazy="true" inverse="false">
                <key foreign-key="SECTEUR_ACT_ENTREPRISES_FKC">
                    <column name="ENTREPRISES_FK" sql-type="NUMBER(19)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.Secteur" foreign-key="ENTREPRISE_SECTEURS_ACT_FKC">
                    <column name="SECTEURS_FK"/>
                </many-to-many>
            </set>
     
            <many-to-one name="legalForm" class="be.awex.renew.business.objects.signaletique.LegalForm" fetch="select" foreign-key="ENTREPRISE_STATUTJUR_FKC" lazy="true">
                <column name="STATUTJUR_FK" not-null="false" sql-type="VARCHAR2(5)"/>
            </many-to-one>
            <many-to-one name="categorie" class="be.awex.renew.business.objects.signaletique.Categorie" fetch="select" foreign-key="ENTREPRISE_CATEGORIE_FKC" lazy="true">
                <column name="CATEGORIE_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <many-to-one name="groupNationality" class="be.awex.renew.business.objects.Geo" fetch="select" foreign-key="GEO_ENTREPRISE_FK" lazy="true">
                <column name="GROUPE_GEO_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <set name="markets" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true" cascade="all,delete-orphan">
                <key foreign-key="MARCHE_ENTREPRISE_FKC">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.signaletique.Market"/>
            </set>
     
            <set name="staffList" lazy="true" fetch="select" inverse="true" cascade="all,delete-orphan">
                <key>
                    <column name="IDENT" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.signaletique.Staff"/>
            </set>
     
            <set name="subsidiaryCompanies" lazy="true" fetch="select" inverse="true" cascade="all,delete-orphan">
                <key>
                    <column name="IDENT" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.signaletique.SubsidiaryCompany"/>
            </set>
     
            <set name="loginEntreprises" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true" cascade="all,delete-orphan">
                <key foreign-key="LOGIN_ENTREPRISE_ENTREPRISE_FK">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.signaletique.LoginEntreprise"/>
            </set>
            <many-to-one name="greffe" class="be.awex.renew.business.objects.signaletique.Greffe" fetch="select" foreign-key="ENTREPRISE_GREFFE_FKC" lazy="true">
                <column name="GREFFE_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <set name="annualData" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true" cascade="all,delete-orphan">
                <key foreign-key="DONNEE_ANNUELLE_ENTREPRISE_FKC">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.signaletique.AnnualData"/>
            </set>
            <set name="naces" table="REL_NACE_ENTREPRISE" order-by="NACES_FK" fetch="select" lazy="true" inverse="false" >
                <key foreign-key="NACE_ENTREPRISES_FKC">
                    <column name="ENTREPRISES_FK" sql-type="NUMBER(19)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.signaletique.Nace" foreign-key="ENTREPRISE_NACES_FKC">
                    <column name="NACES_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>
            <many-to-one name="regionalCenter" class="be.awex.renew.business.objects.signaletique.RegionalCenter" fetch="select" foreign-key="ENTREPRISE_CEN_REG_FKC" lazy="true">
                <column name="CEN_REG_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <many-to-one name="town" class="be.awex.renew.business.objects.signaletique.Town" fetch="select" foreign-key="ENTREPRISE_COMMUNE_FKC" lazy="true">
                <column name="IDCOM"/>
                <column name="IDSCO"/>
            </many-to-one>
            <many-to-one name="townContact" class="be.awex.renew.business.objects.signaletique.Town" fetch="select" foreign-key="ENTREPRISE_COMMUNE_FKC" lazy="true">
                <column name="IDCOM_CONTACT"/>
                <column name="IDSCO_CONTACT"/>
            </many-to-one>
            <set name="products" table="REL_ACE_BPI_PRODUCT" order-by="ACE_OBJECT_LABELS_FK" fetch="select" lazy="true" inverse="false">
                <key column="ENTREPRISES_FK"/>
                <many-to-many class="be.awex.renew.business.objects.thesaurus.AceObjectLabel">
                    <column name="ACE_OBJECT_LABELS_FK" />
                </many-to-many>
            </set>
            <set name="oppos" table="REL_ENTREPRISE_OPPO" order-by="OPPOS_FK" fetch="select" lazy="true" inverse="false">
                <key foreign-key="OPPO_ENTREPRISES_FKC">
                    <column name="ENTREPRISES_FK" sql-type="NUMBER(19)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.Opportunity" foreign-key="ENTREPRISE_OPPOS_FKC">
                    <column name="OPPOS_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>
            <many-to-one name="mailingAction" class="be.awex.renew.business.objects.journal.MailingAction" fetch="select" foreign-key="ENTREPRISE_MAILING_ACTION_FKC" lazy="true">
                <column name="MAILING_ACTION_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <!--
            <many-to-one name="mailingOppo" class="be.awex.renew.business.objects.journal.MailingOppo" fetch="select" foreign-key="ENTREPRISE_MAILING_OPPO_FKC">
                <column name="MAILING_OPPO_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            -->
            <many-to-one name="mailingAudience" class="be.awex.renew.business.objects.journal.MailingAudience" fetch="select" foreign-key="ENTREPRISE_MAILING_AUDIENCE_FK" lazy="true">
                <column name="MAILING_AUDIENCE_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <set name="annonceFormations" order-by="ENTREPRISE_FK" lazy="true" fetch="select" inverse="true">
                <key foreign-key="ANNONCE_FORMATION_ENTREPRISE_F">
                    <column name="ENTREPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.journal.AnnonceFormation"/>
     
            </set>
            <many-to-one name="mailingFormation" class="be.awex.renew.business.objects.journal.MailingFormation" fetch="select" foreign-key="ENTREPRISE_MAILING_FORMATION_F" lazy="true">
                <column name="MAILING_FORMATION_FK" not-null="false" sql-type="NUMBER(19)"/>
            </many-to-one>
            <set name="sofinexs" order-by="ENTERPRISE_FK" fetch="select" lazy="true" inverse="true" >
                <key foreign-key="SOFINEX_ENTREPRISE_FKC">
                    <column name="ENTERPRISE_FK" sql-type="NUMBER(19)"/>
                </key>
                <one-to-many class="be.awex.renew.business.objects.journal.Sofinex"/>
                <filter name="deletedFilter" condition=":deleted = DELETED"/>
            </set>      
            <filter name="deletedFilter"
                condition=":deleted = DELETED"/>
     
        </class>
    </hibernate-mapping>
    Et voici le mapping de la classe "Secteur":

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
         Attention: Generated code! Do not modify by hand!
         Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
      -->
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
              "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
     
    <hibernate-mapping default-cascade="none">
        <class name="be.awex.renew.business.objects.journal.Secteur" table="SECTEUR" dynamic-insert="false" dynamic-update="false">
            <id name="id" type="java.lang.String" unsaved-value="0">
                <column name="IDSECT" sql-type="varchar2(3)"/>
                <generator class="native">
                </generator>
            </id>             
            <set name="opportunities" table="REL_OPPO_SECT" order-by="OPPOS_FK" fetch="select" lazy="true" inverse="true">
                <key foreign-key="OPPO_SECTEUR_OPPO_FKC">
                    <column name="SECTEUR_OPPO_FK" sql-type="NUMBER(19)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.Opportunity" foreign-key="SECTEUR_OPPOS_FKC">
                    <column name="OPPOS_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>
            <set name="entreprises" table="REL_ENT_SECT" order-by="ENTREPRISES_FK" fetch="select" lazy="true" inverse="true">
                <key foreign-key="ENTREPRISE_SECTEURS_FKC">
                    <column name="SECTEURS_FK" sql-type="varchar2(3)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.Entreprise" foreign-key="SECTEUR_ENTREPRISES_FKC">
                    <column name="ENTREPRISES_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>
            <set name="etudiants" table="REL_ETUDIANT_SECT" order-by="ETUDIANTS_FK" fetch="select" lazy="true" inverse="true">
                <key foreign-key="ETUDIANT_SECTEURS_FKC">
                    <column name="SECTEURS_FK" sql-type="varchar2(3)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.Etudiant" foreign-key="SECTEUR_ETUDIANTS_FKC">
                    <column name="ETUDIANTS_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>
            <set name="actions" table="REL_ACTION_SECT" order-by="ACTIONS_FK" fetch="select" lazy="true" inverse="true">
                <key foreign-key="ACTION_SECTEURS_FKC">
                    <column name="SECTEURS_FK" sql-type="varchar2(3)"/>
                </key>
                <many-to-many class="be.awex.renew.business.objects.journal.Action" foreign-key="SECTEUR_ACTIONS_FKC">
                    <column name="ACTIONS_FK" sql-type="NUMBER(19)"/>
                </many-to-many>
            </set>		
        </class>
    </hibernate-mapping>

Discussions similaires

  1. Comment Manipuler des objets dans une liste de type TList ?
    Par PadawanDuDelphi dans le forum Delphi
    Réponses: 1
    Dernier message: 02/11/2006, 15h40
  2. Réponses: 1
    Dernier message: 08/09/2006, 17h21
  3. récupérer un objet dans une liste chainée
    Par marsuwhite dans le forum Langage
    Réponses: 4
    Dernier message: 05/06/2006, 14h05
  4. insertion d'objets dans une liste chainee
    Par mathher dans le forum C++
    Réponses: 8
    Dernier message: 20/04/2006, 16h28
  5. [Swing][JList] Placer un Objet dans une liste
    Par Invité dans le forum Composants
    Réponses: 1
    Dernier message: 17/02/2006, 10h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo