3
"Project-Id-Version: PACKAGE VERSION\n"
4
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
5
"POT-Creation-Date: 2009-06-10 21:02+0000\n"
6
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
7
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
"Language-Team: LANGUAGE <LL@li.org>\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
14
#: association_mapping.xml:30
16
msgid "Association Mappings"
17
msgstr "Mapper les associations"
20
#: association_mapping.xml:33
26
#: association_mapping.xml:35
29
"Association mappings are often the most difficult thing to implement "
30
"correctly. In this section we examine some canonical cases one by one, "
31
"starting with unidirectional mappings and then bidirectional cases. We will "
32
"use <literal>Person</literal> and <literal>Address</literal> in all the "
35
"Correctement mapper les associations est souvent la tâche la plus difficile. "
36
"Dans cette section nous traiterons les cas classiques les uns après les "
37
"autres. Nous commencerons d'abbord par les mappings unidirectionnels, puis "
38
"nous aborderons la question des mappings bidirectionnels. Nous illustrerons "
39
"tous nos exemples avec les classes <literal>Person</literal> et "
40
"<literal>Address</literal>."
43
#: association_mapping.xml:43
46
"Associations will be classified by multiplicity and whether or not they map "
47
"to an intervening join table."
49
"Nous utiliserons deux critères pour classer les associations : le premier "
50
"sera de savoir si l'association est bâti sur une table supplémentaire "
51
"d'association et le deuxieme sera basé sur la multiplicité de cette "
55
#: association_mapping.xml:48
58
"Nullable foreign keys are not considered to be good practice in traditional "
59
"data modelling, so our examples do not use nullable foreign keys. This is "
60
"not a requirement of Hibernate, and the mappings will work if you drop the "
61
"nullability constraints."
63
"Autoriser une clé étrangère nulle est considéré comme un mauvais choix dans "
64
"la construction d'un modèle de données. Nous supposerons donc que dans tous "
65
"les exemples qui vont suivre on aura interdit la valeur nulle pour les clés "
66
"étrangères. Attention, ceci ne veut pas dire que Hibernate ne supporte pas "
67
"les clés étrangères pouvant prendre des valeurs nulles, les exemples qui "
68
"suivent continueront de fonctionner si vous décidiez ne plus imposer la "
69
"contrainte de non-nullité sur les clés étrangères."
72
#: association_mapping.xml:58
74
msgid "Unidirectional associations"
75
msgstr "Association unidirectionnelle"
78
#: association_mapping.xml:61 association_mapping.xml:132
81
msgstr "plusieurs à un"
84
#: association_mapping.xml:63
87
"A <emphasis>unidirectional many-to-one association</emphasis> is the most "
88
"common kind of unidirectional association."
90
"Une <emphasis>association plusieurs-à-un (many-to-one) unidirectionnelle </"
91
"emphasis> est le type que l'on rencontre le plus souvent dans les "
92
"associations unidirectionnelles."
94
#. Tag: programlisting
95
#: association_mapping.xml:68
98
"<![CDATA[<class name=\"Person\">\n"
99
" <id name=\"id\" column=\"personId\">\n"
100
" <generator class=\"native\"/>\n"
102
" <many-to-one name=\"address\" \n"
103
" column=\"addressId\"\n"
104
" not-null=\"true\"/>\n"
107
"<class name=\"Address\">\n"
108
" <id name=\"id\" column=\"addressId\">\n"
109
" <generator class=\"native\"/>\n"
114
#. Tag: programlisting
115
#: association_mapping.xml:69 association_mapping.xml:185
119
"create table Person ( personId bigint not null primary key, addressId bigint "
121
"create table Address ( addressId bigint not null primary key )\n"
126
#: association_mapping.xml:74 association_mapping.xml:145
127
#: association_mapping.xml:210
128
#, fuzzy, no-c-format
131
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
133
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
135
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
137
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
141
#: association_mapping.xml:76
144
"A <emphasis>unidirectional one-to-one association on a foreign key</"
145
"emphasis> is almost identical. The only difference is the column unique "
148
"une <emphasis>association un-à-un (one-to-one) sur une clé étrangère</"
149
"emphasis> est presque identique. La seule différence est sur la contrainte "
150
"d'unicité que l'on impose à cette colonne."
152
#. Tag: programlisting
153
#: association_mapping.xml:81
156
"<![CDATA[<class name=\"Person\">\n"
157
" <id name=\"id\" column=\"personId\">\n"
158
" <generator class=\"native\"/>\n"
160
" <many-to-one name=\"address\" \n"
161
" column=\"addressId\" \n"
163
" not-null=\"true\"/>\n"
166
"<class name=\"Address\">\n"
167
" <id name=\"id\" column=\"addressId\">\n"
168
" <generator class=\"native\"/>\n"
173
#. Tag: programlisting
174
#: association_mapping.xml:82 association_mapping.xml:218
178
"create table Person ( personId bigint not null primary key, addressId bigint "
179
"not null unique )\n"
180
"create table Address ( addressId bigint not null primary key )\n"
185
#: association_mapping.xml:84
186
#, fuzzy, no-c-format
188
"A <emphasis>unidirectional one-to-one association on a primary key</"
189
"emphasis> usually uses a special id generator In this example, however, we "
190
"have reversed the direction of the association:"
192
"Une <emphasis>association un-à-un (one-to-one) unidirectionnelle sur une clé "
193
"primaire</emphasis> utilise un générateur d'identifiant particulier. "
194
"(Remarquez que nous avons inversé le sens de cette association dans cet "
197
#. Tag: programlisting
198
#: association_mapping.xml:90
201
"<![CDATA[<class name=\"Person\">\n"
202
" <id name=\"id\" column=\"personId\">\n"
203
" <generator class=\"native\"/>\n"
207
"<class name=\"Address\">\n"
208
" <id name=\"id\" column=\"personId\">\n"
209
" <generator class=\"foreign\">\n"
210
" <param name=\"property\">person</param>\n"
213
" <one-to-one name=\"person\" constrained=\"true\"/>\n"
217
#. Tag: programlisting
218
#: association_mapping.xml:91 association_mapping.xml:226
222
"create table Person ( personId bigint not null primary key )\n"
223
"create table Address ( personId bigint not null primary key )\n"
228
#: association_mapping.xml:96 association_mapping.xml:118
229
#, fuzzy, no-c-format
231
msgstr "un à plusieurs"
234
#: association_mapping.xml:98
235
#, fuzzy, no-c-format
237
"A <emphasis>unidirectional one-to-many association on a foreign key</"
238
"emphasis> is an unusual case, and is not recommended."
240
"Une <emphasis>association un-à-plusieurs (one-to-many) unidirectionnelle sur "
241
"une clé étrangère</emphasis> est vraiment inhabituelle, et n'est pas "
242
"vraiment recommandée."
244
#. Tag: programlisting
245
#: association_mapping.xml:103
248
"<![CDATA[<class name=\"Person\">\n"
249
" <id name=\"id\" column=\"personId\">\n"
250
" <generator class=\"native\"/>\n"
252
" <set name=\"addresses\">\n"
253
" <key column=\"personId\" \n"
254
" not-null=\"true\"/>\n"
255
" <one-to-many class=\"Address\"/>\n"
259
"<class name=\"Address\">\n"
260
" <id name=\"id\" column=\"addressId\">\n"
261
" <generator class=\"native\"/>\n"
266
#. Tag: programlisting
267
#: association_mapping.xml:104
271
"create table Person ( personId bigint not null primary key )\n"
272
"create table Address ( addressId bigint not null primary key, personId "
273
"bigint not null )\n"
278
#: association_mapping.xml:106
279
#, fuzzy, no-c-format
280
msgid "You should instead use a join table for this kind of association."
282
"Nous pensons qu'il est préférable d'utiliser une table de jointure pour ce "
283
"type d'association."
286
#: association_mapping.xml:115
288
msgid "Unidirectional associations with join tables"
289
msgstr "Associations unidirectionnelles avec tables de jointure"
292
#: association_mapping.xml:120
293
#, fuzzy, no-c-format
295
"A <emphasis>unidirectional one-to-many association on a join table</"
296
"emphasis> is the preferred option. Specifying <literal>unique=\"true\"</"
297
"literal>, changes the multiplicity from many-to-many to one-to-many."
299
"Une <emphasis>association unidirectionnelle un-à-plusieurs (one-to-many) "
300
"avec une table de jointure</emphasis> est un bien meilleur choix. Remarquez "
301
"qu'en spécifiant <literal>unique=\"true\"</literal>, on a changé la "
302
"multiplicité plusieurs-à-plusieurs (many-to-many) pour un-à-plusieurs (one-"
305
#. Tag: programlisting
306
#: association_mapping.xml:126
309
"<![CDATA[<class name=\"Person\">\n"
310
" <id name=\"id\" column=\"personId\">\n"
311
" <generator class=\"native\"/>\n"
313
" <set name=\"addresses\" table=\"PersonAddress\">\n"
314
" <key column=\"personId\"/>\n"
315
" <many-to-many column=\"addressId\"\n"
317
" class=\"Address\"/>\n"
321
"<class name=\"Address\">\n"
322
" <id name=\"id\" column=\"addressId\">\n"
323
" <generator class=\"native\"/>\n"
328
#. Tag: programlisting
329
#: association_mapping.xml:127
333
"create table Person ( personId bigint not null primary key )\n"
334
"create table PersonAddress ( personId not null, addressId bigint not null "
336
"create table Address ( addressId bigint not null primary key )\n"
341
#: association_mapping.xml:134
342
#, fuzzy, no-c-format
344
"A <emphasis>unidirectional many-to-one association on a join table</"
345
"emphasis> is common when the association is optional. For example:"
347
"Une <emphasis>assiociation plusieurs-à-un (many-to-one) unidirectionnelle "
348
"sur une table de jointure</emphasis> est très fréquente quand l'association "
351
#. Tag: programlisting
352
#: association_mapping.xml:139
355
"<![CDATA[<class name=\"Person\">\n"
356
" <id name=\"id\" column=\"personId\">\n"
357
" <generator class=\"native\"/>\n"
359
" <join table=\"PersonAddress\" \n"
360
" optional=\"true\">\n"
361
" <key column=\"personId\" unique=\"true\"/>\n"
362
" <many-to-one name=\"address\"\n"
363
" column=\"addressId\" \n"
364
" not-null=\"true\"/>\n"
368
"<class name=\"Address\">\n"
369
" <id name=\"id\" column=\"addressId\">\n"
370
" <generator class=\"native\"/>\n"
375
#. Tag: programlisting
376
#: association_mapping.xml:140
380
"create table Person ( personId bigint not null primary key )\n"
381
"create table PersonAddress ( personId bigint not null primary key, addressId "
382
"bigint not null )\n"
383
"create table Address ( addressId bigint not null primary key )\n"
388
#: association_mapping.xml:147
389
#, fuzzy, no-c-format
391
"A <emphasis>unidirectional one-to-one association on a join table</emphasis> "
392
"is possible, but extremely unusual."
394
"Une <emphasis>association unidirectionnelle un-à-un (one-to-one) sur une "
395
"table de jointure</emphasis> est extrèmement rare mais envisageable."
397
#. Tag: programlisting
398
#: association_mapping.xml:152
401
"<![CDATA[<class name=\"Person\">\n"
402
" <id name=\"id\" column=\"personId\">\n"
403
" <generator class=\"native\"/>\n"
405
" <join table=\"PersonAddress\" \n"
406
" optional=\"true\">\n"
407
" <key column=\"personId\" \n"
408
" unique=\"true\"/>\n"
409
" <many-to-one name=\"address\"\n"
410
" column=\"addressId\" \n"
411
" not-null=\"true\"\n"
412
" unique=\"true\"/>\n"
416
"<class name=\"Address\">\n"
417
" <id name=\"id\" column=\"addressId\">\n"
418
" <generator class=\"native\"/>\n"
423
#. Tag: programlisting
424
#: association_mapping.xml:153 association_mapping.xml:258
428
"create table Person ( personId bigint not null primary key )\n"
429
"create table PersonAddress ( personId bigint not null primary key, addressId "
430
"bigint not null unique )\n"
431
"create table Address ( addressId bigint not null primary key )\n"
436
#: association_mapping.xml:158 association_mapping.xml:263
437
#, fuzzy, no-c-format
439
msgstr "plusieurs à plusieurs"
442
#: association_mapping.xml:160
443
#, fuzzy, no-c-format
445
"Finally, here is an example of a <emphasis>unidirectional many-to-many "
446
"association</emphasis>."
448
"Finallement, nous avons <emphasis>l'association unidirectionnelle plusieurs-"
449
"à-plusieurs (many-to-many)</emphasis>."
451
#. Tag: programlisting
452
#: association_mapping.xml:164
455
"<![CDATA[<class name=\"Person\">\n"
456
" <id name=\"id\" column=\"personId\">\n"
457
" <generator class=\"native\"/>\n"
459
" <set name=\"addresses\" table=\"PersonAddress\">\n"
460
" <key column=\"personId\"/>\n"
461
" <many-to-many column=\"addressId\"\n"
462
" class=\"Address\"/>\n"
466
"<class name=\"Address\">\n"
467
" <id name=\"id\" column=\"addressId\">\n"
468
" <generator class=\"native\"/>\n"
473
#. Tag: programlisting
474
#: association_mapping.xml:165 association_mapping.xml:271
478
"create table Person ( personId bigint not null primary key )\n"
479
"create table PersonAddress ( personId bigint not null, addressId bigint not "
480
"null, primary key (personId, addressId) )\n"
481
"create table Address ( addressId bigint not null primary key )\n"
486
#: association_mapping.xml:172
488
msgid "Bidirectional associations"
489
msgstr "Associations bidirectionnelles"
492
#: association_mapping.xml:175 association_mapping.xml:236
493
#, fuzzy, no-c-format
494
msgid "one-to-many / many-to-one"
495
msgstr "un à plusieurs / plusieurs à un"
498
#: association_mapping.xml:177
499
#, fuzzy, no-c-format
501
"A <emphasis>bidirectional many-to-one association</emphasis> is the most "
502
"common kind of association. The following example illustrates the standard "
503
"parent/child relationship."
505
"Une <emphasis>association bidirectionnelle plusieurs à un (many-to-one)</"
506
"emphasis> est le type d'association que l'on rencontre le plus souvent. "
507
"(c'est la façon standard de créer des relations parents/enfants.)"
509
#. Tag: programlisting
510
#: association_mapping.xml:183
513
"<![CDATA[<class name=\"Person\">\n"
514
" <id name=\"id\" column=\"personId\">\n"
515
" <generator class=\"native\"/>\n"
517
" <many-to-one name=\"address\" \n"
518
" column=\"addressId\"\n"
519
" not-null=\"true\"/>\n"
522
"<class name=\"Address\">\n"
523
" <id name=\"id\" column=\"addressId\">\n"
524
" <generator class=\"native\"/>\n"
526
" <set name=\"people\" inverse=\"true\">\n"
527
" <key column=\"addressId\"/>\n"
528
" <one-to-many class=\"Person\"/>\n"
534
#: association_mapping.xml:187
535
#, fuzzy, no-c-format
537
"If you use a <literal>List</literal>, or other indexed collection, set the "
538
"<literal>key</literal> column of the foreign key to <literal>not null</"
539
"literal>. Hibernate will manage the association from the collections side to "
540
"maintain the index of each element, making the other side virtually inverse "
541
"by setting <literal>update=\"false\"</literal> and <literal>insert=\"false"
544
"Si vous utilisez une <literal>List</literal> (ou toute autre collection "
545
"indexée) vous devez paramétrer la colonne <literal>key</literal> de la clé "
546
"étrangère à <literal>not null</literal>, et laisser Hibernate gérer "
547
"l'association depuis l'extrémité collection pour maintenir l'index de chaque "
548
"élément (rendant l'autre extrémité virtuellement inverse en paramétrant "
549
"<literal>update=\"false\"</literal> et <literal>insert=\"false\"</literal>):"
551
#. Tag: programlisting
552
#: association_mapping.xml:195
555
"<![CDATA[<class name=\"Person\">\n"
556
" <id name=\"id\"/>\n"
558
" <many-to-one name=\"address\"\n"
559
" column=\"addressId\"\n"
560
" not-null=\"true\"\n"
561
" insert=\"false\"\n"
562
" update=\"false\"/>\n"
565
"<class name=\"Address\">\n"
566
" <id name=\"id\"/>\n"
568
" <list name=\"people\">\n"
569
" <key column=\"addressId\" not-null=\"true\"/>\n"
570
" <list-index column=\"peopleIdx\"/>\n"
571
" <one-to-many class=\"Person\"/>\n"
577
#: association_mapping.xml:197
578
#, fuzzy, no-c-format
580
"If the underlying foreign key column is <literal>NOT NULL</literal>, it is "
581
"important that you define <literal>not-null=\"true\"</literal> on the "
582
"<literal><key></literal> element of the collection mapping. Do not "
583
"only declare <literal>not-null=\"true\"</literal> on a possible nested "
584
"<literal><column></literal> element, but on the <literal><key></"
587
"It is important that you define <literal>not-null=\"true\"</literal> on the "
588
"<literal><key></literal> element of the collection mapping if the "
589
"underlying foreign key column is <literal>NOT NULL</literal>. Don't only "
590
"declare <literal>not-null=\"true\"</literal> on a possible nested "
591
"<literal><column></literal> element, but on the <literal><key></"
595
#: association_mapping.xml:212
596
#, fuzzy, no-c-format
598
"A <emphasis>bidirectional one-to-one association on a foreign key</emphasis> "
601
"Une <emphasis>association bidirectionnelle un à un (one-to-one) sur une clé "
602
"étrangère</emphasis> est aussi très fréquente."
604
#. Tag: programlisting
605
#: association_mapping.xml:217
608
"<![CDATA[<class name=\"Person\">\n"
609
" <id name=\"id\" column=\"personId\">\n"
610
" <generator class=\"native\"/>\n"
612
" <many-to-one name=\"address\" \n"
613
" column=\"addressId\" \n"
615
" not-null=\"true\"/>\n"
618
"<class name=\"Address\">\n"
619
" <id name=\"id\" column=\"addressId\">\n"
620
" <generator class=\"native\"/>\n"
622
" <one-to-one name=\"person\" \n"
623
" property-ref=\"address\"/>\n"
628
#: association_mapping.xml:220
629
#, fuzzy, no-c-format
631
"A <emphasis>bidirectional one-to-one association on a primary key</emphasis> "
632
"uses the special id generator:"
634
"Une <emphasis>association bidirectionnelle un-à-un (one-to-one) sur une clé "
635
"primaire</emphasis> utilise un générateur particulier d'id."
637
#. Tag: programlisting
638
#: association_mapping.xml:225
641
"<![CDATA[<class name=\"Person\">\n"
642
" <id name=\"id\" column=\"personId\">\n"
643
" <generator class=\"native\"/>\n"
645
" <one-to-one name=\"address\"/>\n"
648
"<class name=\"Address\">\n"
649
" <id name=\"id\" column=\"personId\">\n"
650
" <generator class=\"foreign\">\n"
651
" <param name=\"property\">person</param>\n"
654
" <one-to-one name=\"person\" \n"
655
" constrained=\"true\"/>\n"
660
#: association_mapping.xml:233
662
msgid "Bidirectional associations with join tables"
663
msgstr "Associations bidirectionnelles avec table de jointure"
666
#: association_mapping.xml:238
667
#, fuzzy, no-c-format
669
"The following is an example of a <emphasis>bidirectional one-to-many "
670
"association on a join table</emphasis>. The <literal>inverse=\"true\"</"
671
"literal> can go on either end of the association, on the collection, or on "
674
"Une <emphasis>association bidirectionnelle un-à-plusieurs (one-to-many) sur "
675
"une table de jointure </emphasis>. Remarquez que <literal>inverse=\"true\"</"
676
"literal> peut s'appliquer sur les deux extrémités de l' association, sur la "
677
"collection, ou sur la jointure."
679
#. Tag: programlisting
680
#: association_mapping.xml:244
683
"<![CDATA[<class name=\"Person\">\n"
684
" <id name=\"id\" column=\"personId\">\n"
685
" <generator class=\"native\"/>\n"
687
" <set name=\"addresses\" \n"
688
" table=\"PersonAddress\">\n"
689
" <key column=\"personId\"/>\n"
690
" <many-to-many column=\"addressId\"\n"
692
" class=\"Address\"/>\n"
696
"<class name=\"Address\">\n"
697
" <id name=\"id\" column=\"addressId\">\n"
698
" <generator class=\"native\"/>\n"
700
" <join table=\"PersonAddress\" \n"
701
" inverse=\"true\" \n"
702
" optional=\"true\">\n"
703
" <key column=\"addressId\"/>\n"
704
" <many-to-one name=\"person\"\n"
705
" column=\"personId\"\n"
706
" not-null=\"true\"/>\n"
711
#. Tag: programlisting
712
#: association_mapping.xml:245
716
"create table Person ( personId bigint not null primary key )\n"
717
"create table PersonAddress ( personId bigint not null, addressId bigint not "
718
"null primary key )\n"
719
"create table Address ( addressId bigint not null primary key )\n"
724
#: association_mapping.xml:250
725
#, fuzzy, no-c-format
728
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
730
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
732
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
734
"#-#-#-#-# - (PACKAGE VERSION) #-#-#-#-#\n"
738
#: association_mapping.xml:252
739
#, fuzzy, no-c-format
741
"A <emphasis>bidirectional one-to-one association on a join table</emphasis> "
742
"is possible, but extremely unusual."
744
"Une <emphasis>association bidirectionnelle un-à-un (one-to-one) sur une "
745
"table de jointure</emphasis> est extrèmement rare mais envisageable."
747
#. Tag: programlisting
748
#: association_mapping.xml:257
751
"<![CDATA[<class name=\"Person\">\n"
752
" <id name=\"id\" column=\"personId\">\n"
753
" <generator class=\"native\"/>\n"
755
" <join table=\"PersonAddress\" \n"
756
" optional=\"true\">\n"
757
" <key column=\"personId\" \n"
758
" unique=\"true\"/>\n"
759
" <many-to-one name=\"address\"\n"
760
" column=\"addressId\" \n"
761
" not-null=\"true\"\n"
762
" unique=\"true\"/>\n"
766
"<class name=\"Address\">\n"
767
" <id name=\"id\" column=\"addressId\">\n"
768
" <generator class=\"native\"/>\n"
770
" <join table=\"PersonAddress\" \n"
771
" optional=\"true\"\n"
772
" inverse=\"true\">\n"
773
" <key column=\"addressId\" \n"
774
" unique=\"true\"/>\n"
775
" <many-to-one name=\"person\"\n"
776
" column=\"personId\" \n"
777
" not-null=\"true\"\n"
778
" unique=\"true\"/>\n"
784
#: association_mapping.xml:265
785
#, fuzzy, no-c-format
787
"Here is an example of a <emphasis>bidirectional many-to-many association</"
790
"Finallement nous avons <emphasis>l'association bidirectionnelle plusieurs à "
791
"plusieurs</emphasis>."
793
#. Tag: programlisting
794
#: association_mapping.xml:269
797
"<![CDATA[<class name=\"Person\">\n"
798
" <id name=\"id\" column=\"personId\">\n"
799
" <generator class=\"native\"/>\n"
801
" <set name=\"addresses\" table=\"PersonAddress\">\n"
802
" <key column=\"personId\"/>\n"
803
" <many-to-many column=\"addressId\"\n"
804
" class=\"Address\"/>\n"
808
"<class name=\"Address\">\n"
809
" <id name=\"id\" column=\"addressId\">\n"
810
" <generator class=\"native\"/>\n"
812
" <set name=\"people\" inverse=\"true\" table=\"PersonAddress\">\n"
813
" <key column=\"addressId\"/>\n"
814
" <many-to-many column=\"personId\"\n"
815
" class=\"Person\"/>\n"
821
#: association_mapping.xml:278
823
msgid "More complex association mappings"
824
msgstr "Des mappings plus complexes"
827
#: association_mapping.xml:280
828
#, fuzzy, no-c-format
830
"More complex association joins are <emphasis>extremely</emphasis> rare. "
831
"Hibernate handles more complex situations by using SQL fragments embedded in "
832
"the mapping document. For example, if a table with historical account "
833
"information data defines <literal>accountNumber</literal>, "
834
"<literal>effectiveEndDate</literal> and <literal>effectiveStartDate</"
835
"literal>columns, it would be mapped as follows:"
837
"Des associations encore plus complexes sont <emphasis>extrêmement</emphasis> "
838
"rares. Hibernate permet de gérer des situations plus complexes en utilisant "
839
"des parties SQL dans les fichiers de mapping. Par exemple, si une table avec "
840
"l'historiques des informations d'un compte définit les colonnes "
841
"<literal>accountNumber</literal>, <literal>effectiveEndDate</literal> et "
842
"<literal>effectiveStartDate</literal>, mappées de telle sorte:"
844
#. Tag: programlisting
845
#: association_mapping.xml:289
848
"<![CDATA[<properties name=\"currentAccountKey\">\n"
849
" <property name=\"accountNumber\" type=\"string\" not-null=\"true\"/>\n"
850
" <property name=\"currentAccount\" type=\"boolean\">\n"
851
" <formula>case when effectiveEndDate is null then 1 else 0 end</"
855
"<property name=\"effectiveEndDate\" type=\"date\"/>\n"
856
"<property name=\"effectiveStateDate\" type=\"date\" not-null=\"true\"/>]]>"
860
#: association_mapping.xml:291
861
#, fuzzy, no-c-format
863
"You can then map an association to the <emphasis>current</emphasis> "
864
"instance, the one with null <literal>effectiveEndDate</literal>, by using:"
866
"alors nous pouvons mapper une association à l'instance <emphasis>courante</"
867
"emphasis> (celle avec une <literal>effectiveEndDate</literal>) nulle en "
870
#. Tag: programlisting
871
#: association_mapping.xml:296
874
"<![CDATA[<many-to-one name=\"currentAccountInfo\" \n"
875
" property-ref=\"currentAccountKey\"\n"
876
" class=\"AccountInfo\">\n"
877
" <column name=\"accountNumber\"/>\n"
878
" <formula>'1'</formula>\n"
883
#: association_mapping.xml:298
884
#, fuzzy, no-c-format
886
"In a more complex example, imagine that the association between "
887
"<literal>Employee</literal> and <literal>Organization</literal> is "
888
"maintained in an <literal>Employment</literal> table full of historical "
889
"employment data. An association to the employee's <emphasis>most recent</"
890
"emphasis> employer, the one with the most recent <literal>startDate</"
891
"literal>, could be mapped in the following way:"
893
"Dans un exemple plus complexe, imaginez qu'une association entre "
894
"<literal>Employee</literal> et <literal>Organization</literal> est gérée "
895
"dans une table <literal>Employment</literal> pleines de données historiques. "
896
"Dans ce cas, une association vers l'employeur <emphasis>le plus récent</"
897
"emphasis> (celui avec la <literal>startDate</literal> la plus récente) "
898
"pourrait être mappée comme cela:"
900
#. Tag: programlisting
901
#: association_mapping.xml:306
905
" <key column=\"employeeId\"/>\n"
907
" select employeeId, orgId \n"
908
" from Employments \n"
910
" having startDate = max(startDate)\n"
912
" <many-to-one name=\"mostRecentEmployer\" \n"
913
" class=\"Organization\" \n"
914
" column=\"orgId\"/>\n"
919
#: association_mapping.xml:308
920
#, fuzzy, no-c-format
922
"This functionality allows a degree of creativity and flexibility, but it is "
923
"more practical to handle these kinds of cases using HQL or a criteria query."
925
"Vous pouvez être créatif grace à ces possibilités, mais il est généralement "
926
"plus pratique d'utiliser des requêtes HQL ou criteria dans ce genre de "