-
Notifications
You must be signed in to change notification settings - Fork 0
/
hibernate-mapping-3.0.rnc
1461 lines (1451 loc) · 53.4 KB
/
hibernate-mapping-3.0.rnc
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Hibernate Mapping DTD.
#
# <!DOCTYPE hibernate-mapping PUBLIC
# "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
# "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
#
# An instance of this XML document may contain mappings for an arbitrary
# number of classes. The class mappings may contain associations to classes
# mapped in the same document or in another document. No class may be
# mapped more than once. Each document may also contain definitions of an
# arbitrary number of queries, and import declarations of arbitrary classes.
#
# The document root.
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
hibernate-mapping =
element hibernate-mapping {
attlist.hibernate-mapping,
meta*,
identifier-generator*,
typedef*,
filter-def*,
import*,
(class | subclass | joined-subclass | union-subclass)*,
resultset*,
(query | sql-query)*,
filter-def*,
fetch-profile*,
database-object*
}
attlist.hibernate-mapping &= attribute schema { text }?
# default: none
attlist.hibernate-mapping &= attribute catalog { text }?
# default: none
attlist.hibernate-mapping &=
[ a:defaultValue = "none" ] attribute default-cascade { text }?
attlist.hibernate-mapping &=
[ a:defaultValue = "property" ] attribute default-access { text }?
attlist.hibernate-mapping &=
[ a:defaultValue = "true" ]
attribute default-lazy { "true" | "false" }?
attlist.hibernate-mapping &=
[ a:defaultValue = "true" ]
attribute auto-import { "true" | "false" }?
attlist.hibernate-mapping &= attribute package { text }?
# default: none
# <meta.../> is used to assign meta-level attributes to a class
# or property. Is currently used by codegenerator as a placeholder for
# values that is not directly related to OR mappings.
meta = element meta { attlist.meta, text }
attlist.meta &= attribute attribute { text }
attlist.meta &=
[ a:defaultValue = "true" ] attribute inherit { "true" | "false" }?
# <identifier-generator.../> allows customized short-naming of IdentifierGenerator implementations.
identifier-generator =
element identifier-generator { attlist.identifier-generator, empty }
attlist.identifier-generator &= attribute name { text }
attlist.identifier-generator &= attribute class { text }
# <typedef.../> allows defining a customized type mapping for a Hibernate type. May
# contain parameters for parameterizable types.
typedef = element typedef { attlist.typedef, param* }
attlist.typedef &= attribute class { text }
attlist.typedef &= attribute name { text }
# IMPORT element definition; an explicit query language "import"
import = element import { attlist.import, empty }
attlist.import &= attribute class { text }
attlist.import &= attribute rename { text }?
# default: unqualified class name
# Root entity mapping. Poorly named as entities do not have to be represented by
# classes at all. Mapped entities may be represented via different methodologies
# (POJO, Map, Dom4j).
class =
element class {
attlist.class,
meta*,
subselect?,
cache?,
synchronize*,
comment?,
tuplizer*,
(id | composite-id),
discriminator?,
natural-id?,
(version | timestamp)?,
(property
| many-to-one
| one-to-one
| component
| dynamic-component
| properties
| any
| map
| set
| \list
| bag
| idbag
| array
| primitive-array)*,
((join*, subclass*) | joined-subclass* | union-subclass*),
loader?,
sql-insert?,
sql-update?,
sql-delete?,
filter*,
fetch-profile*,
resultset*,
(query | sql-query)*
}
attlist.class &= attribute entity-name { text }?
attlist.class &= attribute name { text }?
# this is the class name
attlist.class &= attribute proxy { text }?
# default: no proxy interface
attlist.class &= attribute lazy { "true" | "false" }?
attlist.class &= attribute table { text }?
# default: unqualified classname
attlist.class &= attribute schema { text }?
# default: none
attlist.class &= attribute catalog { text }?
# default: none
attlist.class &= attribute subselect { text }?
attlist.class &= attribute discriminator-value { text }?
# default: unqualified class name | none
attlist.class &=
[ a:defaultValue = "true" ] attribute mutable { "true" | "false" }?
attlist.class &= attribute abstract { "true" | "false" }?
attlist.class &=
[ a:defaultValue = "implicit" ]
attribute polymorphism { "implicit" | "explicit" }?
attlist.class &= attribute where { text }?
# default: none
attlist.class &= attribute persister { text }?
attlist.class &=
[ a:defaultValue = "false" ]
attribute dynamic-update { "true" | "false" }?
attlist.class &=
[ a:defaultValue = "false" ]
attribute dynamic-insert { "true" | "false" }?
attlist.class &= attribute batch-size { text }?
attlist.class &=
[ a:defaultValue = "false" ]
attribute select-before-update { "true" | "false" }?
attlist.class &=
[ a:defaultValue = "version" ]
attribute optimistic-lock { "none" | "version" | "dirty" | "all" }?
attlist.class &= attribute check { text }?
# default: none
attlist.class &= attribute rowid { text }?
attlist.class &= attribute node { text }?
# TUPLIZER element; defines tuplizer to use for a component/entity for a given entity-mode
tuplizer = element tuplizer { attlist.tuplizer, empty }
attlist.tuplizer &=
attribute entity-mode { "pojo" | "dom4j" | "dynamic-map" }?
# entity mode for which tuplizer is in effect
attlist.tuplizer &= attribute class { text }
# the tuplizer class to use
# FILTER-DEF element; top-level filter definition.
filter-def =
element filter-def { attlist.filter-def, (text | filter-param)* }
attlist.filter-def &= attribute name { text }
# The filter name
attlist.filter-def &= attribute condition { text }?
# FILTER-PARAM element; qualifies parameters found within a FILTER-DEF
# condition.
filter-param = element filter-param { attlist.filter-param, empty }
attlist.filter-param &= attribute name { text }
# The parameter name
attlist.filter-param &= attribute type { text }
# The parameter type
# FILTER element; used to apply a filter.
filter = element filter { attlist.filter, text }
attlist.filter &= attribute name { text }
attlist.filter &= attribute condition { text }?
#
fetch-profile = element fetch-profile { attlist.fetch-profile, fetch* }
attlist.fetch-profile &= attribute name { text }
# The <fetch> element defines a single path to which the fetch
# refers, as well as the style of fetch to apply. The 'root' of the
# path is different depending upon the context in which the
# containing <fetch-profile/> occurs; within a <class/> element,
# the entity-name of the containing class mapping is assumed...
fetch = element fetch { attlist.fetch, empty }
attlist.fetch &= attribute entity { text }?
# Implied as long as the containing fetch profile is contained in a class mapping
attlist.fetch &= attribute association { text }
attlist.fetch &=
[ a:defaultValue = "join" ] attribute style { "join" | "select" }?
# A join allows some properties of a class to be persisted to a second table
join =
element join {
attlist.join,
subselect?,
comment?,
key,
(property | many-to-one | component | dynamic-component | any)*,
sql-insert?,
sql-update?,
sql-delete?
}
attlist.join &= attribute table { text }
attlist.join &= attribute schema { text }?
# default: none
attlist.join &= attribute catalog { text }?
# default: none
attlist.join &= attribute subselect { text }?
attlist.join &=
[ a:defaultValue = "join" ] attribute fetch { "join" | "select" }?
attlist.join &=
[ a:defaultValue = "false" ] attribute inverse { "true" | "false" }?
attlist.join &=
[ a:defaultValue = "false" ] attribute optional { "true" | "false" }?
# A natural-id element allows declaration of the unique business key
natural-id =
element natural-id {
attlist.natural-id,
(property | many-to-one | component | dynamic-component | any)*
}
attlist.natural-id &=
[ a:defaultValue = "false" ] attribute mutable { "true" | "false" }?
# Declares the id type, column and generation algorithm for an entity class.
# If a name attribut is given, the id is exposed to the application through the
# named property of the class. If not, the id is only exposed to the application
# via Session.getIdentifier()
id = element id { attlist.id, meta*, column*, type?, generator? }
attlist.id &= attribute name { text }?
attlist.id &= attribute node { text }?
attlist.id &= attribute access { text }?
attlist.id &= attribute column { text }?
attlist.id &= attribute type { text }?
attlist.id &= attribute length { text }?
attlist.id &= attribute unsaved-value { text }?
# any|none|null|undefined|0|-1|...
# A composite key may be modelled by a java class with a property for each
# key column. The class must implement java.io.Serializable and reimplement equals()
# and hashCode().
composite-id =
element composite-id {
attlist.composite-id,
meta*,
(key-property | key-many-to-one)+,
generator?
}
attlist.composite-id &= attribute class { text }?
attlist.composite-id &=
[ a:defaultValue = "false" ] attribute mapped { "true" | "false" }?
attlist.composite-id &= attribute name { text }?
attlist.composite-id &= attribute node { text }?
attlist.composite-id &= attribute access { text }?
attlist.composite-id &=
[ a:defaultValue = "undefined" ]
attribute unsaved-value { "undefined" | "any" | "none" }?
# Polymorphic data requires a column holding a class discriminator value. This
# value is not directly exposed to the application.
discriminator =
element discriminator { attlist.discriminator, (column | formula)? }
attlist.discriminator &= attribute column { text }?
# default: "class"|none
attlist.discriminator &= attribute formula { text }?
attlist.discriminator &=
[ a:defaultValue = "string" ] attribute type { text }?
attlist.discriminator &=
[ a:defaultValue = "true" ] attribute not-null { "true" | "false" }?
attlist.discriminator &= attribute length { text }?
attlist.discriminator &=
[ a:defaultValue = "false" ] attribute force { "true" | "false" }?
attlist.discriminator &=
[ a:defaultValue = "true" ] attribute insert { "true" | "false" }?
# Versioned data requires a column holding a version number. This is exposed to the
# application through a property of the Java class.
version = element version { attlist.version, meta*, column* }
attlist.version &= attribute name { text }
attlist.version &= attribute node { text }?
attlist.version &= attribute access { text }?
attlist.version &= attribute column { text }?
attlist.version &=
[ a:defaultValue = "integer" ] attribute type { text }?
attlist.version &=
[ a:defaultValue = "undefined" ]
attribute unsaved-value { "null" | "negative" | "undefined" }?
attlist.version &=
[ a:defaultValue = "never" ]
attribute generated { "never" | "always" }?
attlist.version &= attribute insert { "true" | "false" }?
timestamp = element timestamp { attlist.timestamp, meta* }
attlist.timestamp &= attribute name { text }
attlist.timestamp &= attribute node { text }?
attlist.timestamp &= attribute column { text }?
attlist.timestamp &= attribute access { text }?
attlist.timestamp &=
[ a:defaultValue = "null" ]
attribute unsaved-value { "null" | "undefined" }?
attlist.timestamp &=
[ a:defaultValue = "vm" ] attribute source { "vm" | "db" }?
attlist.timestamp &=
[ a:defaultValue = "never" ]
attribute generated { "never" | "always" }?
# Subclass declarations are nested beneath the root class declaration to achieve
# polymorphic persistence with the table-per-hierarchy mapping strategy.
#
# See the note on the class element regarding <pojo/> vs. @name usage...
subclass =
element subclass {
attlist.subclass,
meta*,
tuplizer*,
synchronize*,
(property
| many-to-one
| one-to-one
| component
| dynamic-component
| any
| map
| set
| \list
| bag
| idbag
| array
| primitive-array)*,
join*,
subclass*,
loader?,
sql-insert?,
sql-update?,
sql-delete?,
fetch-profile*,
resultset*,
(query | sql-query)*
}
attlist.subclass &= attribute entity-name { text }?
attlist.subclass &= attribute name { text }?
attlist.subclass &= attribute proxy { text }?
# default: no proxy interface
attlist.subclass &= attribute discriminator-value { text }?
# default: unqualified class name | none
attlist.subclass &=
[ a:defaultValue = "false" ]
attribute dynamic-update { "true" | "false" }?
attlist.subclass &=
[ a:defaultValue = "false" ]
attribute dynamic-insert { "true" | "false" }?
attlist.subclass &=
[ a:defaultValue = "false" ]
attribute select-before-update { "true" | "false" }?
attlist.subclass &= attribute extends { text }?
# default: empty when a toplevel, otherwise the nearest class definition
attlist.subclass &= attribute lazy { "true" | "false" }?
attlist.subclass &= attribute abstract { "true" | "false" }?
attlist.subclass &= attribute persister { text }?
attlist.subclass &= attribute batch-size { text }?
attlist.subclass &= attribute node { text }?
# Joined subclasses are used for the normalized table-per-subclass mapping strategy
#
# See the note on the class element regarding <pojo/> vs. @name usage...
joined-subclass =
element joined-subclass {
attlist.joined-subclass,
meta*,
subselect?,
synchronize*,
comment?,
tuplizer*,
key,
(property
| many-to-one
| one-to-one
| component
| dynamic-component
| properties
| any
| map
| set
| \list
| bag
| idbag
| array
| primitive-array)*,
joined-subclass*,
loader?,
sql-insert?,
sql-update?,
sql-delete?,
fetch-profile*,
resultset*,
(query | sql-query)*
}
attlist.joined-subclass &= attribute entity-name { text }?
attlist.joined-subclass &= attribute name { text }?
attlist.joined-subclass &= attribute proxy { text }?
# default: no proxy interface
attlist.joined-subclass &= attribute table { text }?
# default: unqualified class name
attlist.joined-subclass &= attribute schema { text }?
attlist.joined-subclass &= attribute catalog { text }?
attlist.joined-subclass &= attribute subselect { text }?
attlist.joined-subclass &=
[ a:defaultValue = "false" ]
attribute dynamic-update { "true" | "false" }?
attlist.joined-subclass &=
[ a:defaultValue = "false" ]
attribute dynamic-insert { "true" | "false" }?
attlist.joined-subclass &=
[ a:defaultValue = "false" ]
attribute select-before-update { "true" | "false" }?
attlist.joined-subclass &= attribute extends { text }?
# default: none when toplevel, otherwise the nearest class definition
attlist.joined-subclass &= attribute lazy { "true" | "false" }?
attlist.joined-subclass &= attribute abstract { "true" | "false" }?
attlist.joined-subclass &= attribute persister { text }?
attlist.joined-subclass &= attribute check { text }?
# default: none
attlist.joined-subclass &= attribute batch-size { text }?
attlist.joined-subclass &= attribute node { text }?
# Union subclasses are used for the table-per-concrete-class mapping strategy
#
# See the note on the class element regarding <pojo/> vs. @name usage...
union-subclass =
element union-subclass {
attlist.union-subclass,
meta*,
subselect?,
synchronize*,
comment?,
tuplizer*,
(property
| many-to-one
| one-to-one
| component
| dynamic-component
| properties
| any
| map
| set
| \list
| bag
| idbag
| array
| primitive-array)*,
union-subclass*,
loader?,
sql-insert?,
sql-update?,
sql-delete?,
fetch-profile*,
resultset*,
(query | sql-query)*
}
attlist.union-subclass &= attribute entity-name { text }?
attlist.union-subclass &= attribute name { text }?
attlist.union-subclass &= attribute proxy { text }?
# default: no proxy interface
attlist.union-subclass &= attribute table { text }?
# default: unqualified class name
attlist.union-subclass &= attribute schema { text }?
attlist.union-subclass &= attribute catalog { text }?
attlist.union-subclass &= attribute subselect { text }?
attlist.union-subclass &=
[ a:defaultValue = "false" ]
attribute dynamic-update { "true" | "false" }?
attlist.union-subclass &=
[ a:defaultValue = "false" ]
attribute dynamic-insert { "true" | "false" }?
attlist.union-subclass &=
[ a:defaultValue = "false" ]
attribute select-before-update { "true" | "false" }?
attlist.union-subclass &= attribute extends { text }?
# default: none when toplevel, otherwise the nearest class definition
attlist.union-subclass &= attribute lazy { "true" | "false" }?
attlist.union-subclass &= attribute abstract { "true" | "false" }?
attlist.union-subclass &= attribute persister { text }?
attlist.union-subclass &= attribute check { text }?
# default: none
attlist.union-subclass &= attribute batch-size { text }?
attlist.union-subclass &= attribute node { text }?
# Property of an entity class or component, component-element, composite-id, etc.
# JavaBeans style properties are mapped to table columns.
property =
element property {
attlist.property, meta*, (column | formula)*, type?
}
attlist.property &= attribute name { text }
attlist.property &= attribute node { text }?
attlist.property &= attribute access { text }?
attlist.property &= attribute type { text }?
attlist.property &= attribute column { text }?
attlist.property &= attribute length { text }?
attlist.property &= attribute precision { text }?
attlist.property &= attribute scale { text }?
attlist.property &= attribute not-null { "true" | "false" }?
attlist.property &=
[ a:defaultValue = "false" ] attribute unique { "true" | "false" }?
attlist.property &= attribute unique-key { text }?
attlist.property &= attribute index { text }?
# include the columns spanned by this property in an index
attlist.property &= attribute update { "true" | "false" }?
attlist.property &= attribute insert { "true" | "false" }?
attlist.property &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.property &= attribute formula { text }?
attlist.property &=
[ a:defaultValue = "false" ] attribute lazy { "true" | "false" }?
attlist.property &=
[ a:defaultValue = "never" ]
attribute generated { "never" | "insert" | "always" }?
# Declares the type of the containing property (overrides an eventually existing type
# attribute of the property). May contain param elements to customize a ParametrizableType.
type = element type { attlist.type, param* }
attlist.type &= attribute name { text }
# Declares an association between two entities (Or from a component, component element,
# etc. to an entity).
many-to-one =
element many-to-one {
attlist.many-to-one, meta*, (column | formula)*
}
attlist.many-to-one &= attribute name { text }
attlist.many-to-one &= attribute access { text }?
attlist.many-to-one &= attribute class { text }?
attlist.many-to-one &= attribute entity-name { text }?
attlist.many-to-one &= attribute column { text }?
attlist.many-to-one &= attribute not-null { "true" | "false" }?
attlist.many-to-one &=
[ a:defaultValue = "false" ] attribute unique { "true" | "false" }?
attlist.many-to-one &= attribute unique-key { text }?
attlist.many-to-one &= attribute index { text }?
attlist.many-to-one &= attribute cascade { text }?
attlist.many-to-one &=
attribute outer-join { "true" | "false" | "auto" }?
attlist.many-to-one &= attribute fetch { "join" | "select" }?
attlist.many-to-one &=
[ a:defaultValue = "true" ] attribute update { "true" | "false" }?
attlist.many-to-one &=
[ a:defaultValue = "true" ] attribute insert { "true" | "false" }?
attlist.many-to-one &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.many-to-one &= attribute foreign-key { text }?
attlist.many-to-one &= attribute property-ref { text }?
attlist.many-to-one &= attribute formula { text }?
attlist.many-to-one &=
attribute lazy { "false" | "proxy" | "no-proxy" }?
attlist.many-to-one &=
[ a:defaultValue = "exception" ]
attribute not-found { "exception" | "ignore" }?
attlist.many-to-one &= attribute node { text }?
attlist.many-to-one &=
[ a:defaultValue = "true" ] attribute embed-xml { "true" | "false" }?
# Declares a one-to-one association between two entities (Or from a component,
# component element, etc. to an entity).
one-to-one = element one-to-one { attlist.one-to-one, meta*, formula* }
attlist.one-to-one &= attribute name { text }
attlist.one-to-one &= attribute formula { text }?
attlist.one-to-one &= attribute access { text }?
attlist.one-to-one &= attribute class { text }?
attlist.one-to-one &= attribute entity-name { text }?
attlist.one-to-one &= attribute cascade { text }?
attlist.one-to-one &=
attribute outer-join { "true" | "false" | "auto" }?
attlist.one-to-one &= attribute fetch { "join" | "select" }?
attlist.one-to-one &=
[ a:defaultValue = "false" ]
attribute constrained { "true" | "false" }?
attlist.one-to-one &= attribute foreign-key { text }?
attlist.one-to-one &= attribute property-ref { text }?
attlist.one-to-one &= attribute lazy { "false" | "proxy" | "no-proxy" }?
attlist.one-to-one &= attribute node { text }?
attlist.one-to-one &=
[ a:defaultValue = "true" ] attribute embed-xml { "true" | "false" }?
# A property embedded in a composite identifier or map index (always not-null).
key-property =
element key-property { attlist.key-property, meta*, column*, type? }
attlist.key-property &= attribute name { text }
attlist.key-property &= attribute access { text }?
attlist.key-property &= attribute type { text }?
attlist.key-property &= attribute column { text }?
attlist.key-property &= attribute length { text }?
attlist.key-property &= attribute node { text }?
# A many-to-one association embedded in a composite identifier or map index
# (always not-null, never cascade).
key-many-to-one =
element key-many-to-one { attlist.key-many-to-one, meta*, column* }
attlist.key-many-to-one &= attribute name { text }
attlist.key-many-to-one &= attribute access { text }?
attlist.key-many-to-one &= attribute class { text }?
attlist.key-many-to-one &= attribute entity-name { text }?
attlist.key-many-to-one &= attribute column { text }?
attlist.key-many-to-one &= attribute foreign-key { text }?
attlist.key-many-to-one &= attribute lazy { "false" | "proxy" }?
# An "any" association is a polymorphic association to any table with
# the given identifier type. The first listed column is a VARCHAR column
# holding the name of the class (for that row).
any = element any { attlist.any, meta*, meta-value*, column, column+ }
attlist.any &= attribute id-type { text }
attlist.any &= attribute meta-type { text }?
# - default: Hibernate.STRING
attlist.any &= attribute name { text }
attlist.any &= attribute access { text }?
attlist.any &=
[ a:defaultValue = "true" ] attribute insert { "true" | "false" }?
attlist.any &=
[ a:defaultValue = "true" ] attribute update { "true" | "false" }?
attlist.any &= attribute cascade { text }?
attlist.any &= attribute index { text }?
# include the columns spanned by this association in an index
attlist.any &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.any &=
[ a:defaultValue = "false" ] attribute lazy { "true" | "false" }?
attlist.any &= attribute node { text }?
meta-value = element meta-value { attlist.meta-value, empty }
attlist.meta-value &= attribute value { text }
attlist.meta-value &= attribute class { text }
# A component is a user-defined class, persisted along with its containing entity
# to the table of the entity class. JavaBeans style properties of the component are
# mapped to columns of the table of the containing entity. A null component reference
# is mapped to null values in all columns and vice versa. Components do not support
# shared reference semantics.
component =
element component {
attlist.component,
meta*,
tuplizer*,
\parent?,
(property
| many-to-one
| one-to-one
| component
| dynamic-component
| any
| map
| set
| \list
| bag
| array
| primitive-array)*
}
attlist.component &= attribute class { text }?
attlist.component &= attribute name { text }
attlist.component &= attribute access { text }?
attlist.component &=
[ a:defaultValue = "false" ] attribute unique { "true" | "false" }?
attlist.component &=
[ a:defaultValue = "true" ] attribute update { "true" | "false" }?
attlist.component &=
[ a:defaultValue = "true" ] attribute insert { "true" | "false" }?
attlist.component &=
[ a:defaultValue = "false" ] attribute lazy { "true" | "false" }?
attlist.component &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
attlist.component &= attribute node { text }?
# A dynamic-component maps columns of the database entity to a java.util.Map
# at the Java level
dynamic-component =
element dynamic-component {
attlist.dynamic-component,
(property
| many-to-one
| one-to-one
| component
| dynamic-component
| any
| map
| set
| \list
| bag
| array
| primitive-array)*
}
attlist.dynamic-component &= attribute name { text }
attlist.dynamic-component &= attribute access { text }?
attlist.dynamic-component &=
[ a:defaultValue = "false" ] attribute unique { "true" | "false" }?
attlist.dynamic-component &=
[ a:defaultValue = "true" ] attribute update { "true" | "false" }?
attlist.dynamic-component &=
[ a:defaultValue = "true" ] attribute insert { "true" | "false" }?
attlist.dynamic-component &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
attlist.dynamic-component &= attribute node { text }?
# properties declares that the contained properties form an alternate key. The name
# attribute allows an alternate key to be used as the target of a property-ref.
properties =
element properties {
attlist.properties,
(property | many-to-one | component | dynamic-component)*
}
attlist.properties &= attribute name { text }
attlist.properties &=
[ a:defaultValue = "false" ] attribute unique { "true" | "false" }?
attlist.properties &=
[ a:defaultValue = "true" ] attribute insert { "true" | "false" }?
attlist.properties &=
[ a:defaultValue = "true" ] attribute update { "true" | "false" }?
attlist.properties &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
attlist.properties &= attribute node { text }?
# The parent element maps a property of the component class as a pointer back to
# the owning entity.
\parent = element parent { attlist.parent, empty }
attlist.parent &= attribute name { text }
# Collection declarations nested inside a class declaration indicate a foreign key
# relationship from the collection table to the enclosing class.
map =
element map {
attlist.map,
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(map-key
| composite-map-key
| map-key-many-to-many
| index
| composite-index
| index-many-to-many
| index-many-to-any),
(\element
| one-to-many
| many-to-many
| composite-element
| many-to-any),
loader?,
sql-insert?,
sql-update?,
sql-delete?,
sql-delete-all?,
filter*
}
attlist.map &= attribute name { text }
attlist.map &= attribute access { text }?
attlist.map &= attribute table { text }?
# default: name
attlist.map &= attribute schema { text }?
# default: none
attlist.map &= attribute subselect { text }?
attlist.map &= attribute catalog { text }?
# default: none
attlist.map &= attribute lazy { "true" | "false" | "extra" }?
attlist.map &=
[ a:defaultValue = "true" ] attribute mutable { "true" | "false" }?
attlist.map &=
[ a:defaultValue = "false" ] attribute inverse { "true" | "false" }?
attlist.map &= [ a:defaultValue = "unsorted" ] attribute sort { text }?
# unsorted|natural|"comparator class", default: unsorted
attlist.map &= attribute cascade { text }?
attlist.map &= attribute order-by { text }?
# default: none
attlist.map &= attribute where { text }?
# default: none
attlist.map &= attribute batch-size { text }?
attlist.map &= attribute outer-join { "true" | "false" | "auto" }?
attlist.map &= attribute fetch { "join" | "select" | "subselect" }?
attlist.map &= attribute check { text }?
# default: none
attlist.map &= attribute persister { text }?
attlist.map &= attribute collection-type { text }?
attlist.map &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.map &= attribute node { text }?
attlist.map &=
[ a:defaultValue = "true" ] attribute embed-xml { "true" | "false" }?
set =
element set {
attlist.set,
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(\element
| one-to-many
| many-to-many
| composite-element
| many-to-any),
loader?,
sql-insert?,
sql-update?,
sql-delete?,
sql-delete-all?,
filter*
}
attlist.set &= attribute name { text }
attlist.set &= attribute access { text }?
attlist.set &= attribute table { text }?
# default: name
attlist.set &= attribute schema { text }?
# default: none
attlist.set &= attribute catalog { text }?
# default: none
attlist.set &= attribute subselect { text }?
attlist.set &= attribute lazy { "true" | "false" | "extra" }?
attlist.set &= [ a:defaultValue = "unsorted" ] attribute sort { text }?
# unsorted|natural|"comparator class"
attlist.set &=
[ a:defaultValue = "false" ] attribute inverse { "true" | "false" }?
attlist.set &=
[ a:defaultValue = "true" ] attribute mutable { "true" | "false" }?
attlist.set &= attribute cascade { text }?
attlist.set &= attribute order-by { text }?
# default: none
attlist.set &= attribute where { text }?
# default: none
attlist.set &= attribute batch-size { text }?
attlist.set &= attribute outer-join { "true" | "false" | "auto" }?
attlist.set &= attribute fetch { "join" | "select" | "subselect" }?
attlist.set &= attribute persister { text }?
attlist.set &= attribute collection-type { text }?
attlist.set &= attribute check { text }?
# default: none
attlist.set &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.set &= attribute node { text }?
attlist.set &=
[ a:defaultValue = "true" ] attribute embed-xml { "true" | "false" }?
bag =
element bag {
attlist.bag,
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(\element
| one-to-many
| many-to-many
| composite-element
| many-to-any),
loader?,
sql-insert?,
sql-update?,
sql-delete?,
sql-delete-all?,
filter*
}
attlist.bag &= attribute name { text }
attlist.bag &= attribute access { text }?
attlist.bag &= attribute table { text }?
# default: name
attlist.bag &= attribute schema { text }?
# default: none
attlist.bag &= attribute catalog { text }?
# default: none
attlist.bag &= attribute subselect { text }?
attlist.bag &= attribute lazy { "true" | "false" | "extra" }?
attlist.bag &=
[ a:defaultValue = "false" ] attribute inverse { "true" | "false" }?
attlist.bag &=
[ a:defaultValue = "true" ] attribute mutable { "true" | "false" }?
attlist.bag &= attribute cascade { text }?
attlist.bag &= attribute order-by { text }?
# default: none
attlist.bag &= attribute where { text }?
# default: none
attlist.bag &= attribute batch-size { text }?
attlist.bag &= attribute outer-join { "true" | "false" | "auto" }?
attlist.bag &= attribute fetch { "join" | "select" | "subselect" }?
attlist.bag &= attribute persister { text }?
attlist.bag &= attribute collection-type { text }?
attlist.bag &= attribute check { text }?
# default: none
attlist.bag &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.bag &= attribute node { text }?
attlist.bag &=
[ a:defaultValue = "true" ] attribute embed-xml { "true" | "false" }?
idbag =
element idbag {
attlist.idbag,
meta*,
subselect?,
cache?,
synchronize*,
comment?,
collection-id,
key,
(\element | many-to-many | composite-element | many-to-any),
loader?,
sql-insert?,
sql-update?,
sql-delete?,
sql-delete-all?,
filter*
}
attlist.idbag &= attribute name { text }
attlist.idbag &= attribute access { text }?
attlist.idbag &= attribute table { text }?
# default: name
attlist.idbag &= attribute schema { text }?
# default: none
attlist.idbag &= attribute catalog { text }?
# default: none
attlist.idbag &= attribute subselect { text }?
attlist.idbag &= attribute lazy { "true" | "false" | "extra" }?
attlist.idbag &=
[ a:defaultValue = "true" ] attribute mutable { "true" | "false" }?
attlist.idbag &= attribute cascade { text }?
attlist.idbag &= attribute order-by { text }?
# default: none
attlist.idbag &= attribute where { text }?
# default: none
attlist.idbag &= attribute batch-size { text }?
attlist.idbag &= attribute outer-join { "true" | "false" | "auto" }?
attlist.idbag &= attribute fetch { "join" | "select" | "subselect" }?
attlist.idbag &= attribute persister { text }?
attlist.idbag &= attribute collection-type { text }?
attlist.idbag &= attribute check { text }?
# default: none
attlist.idbag &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.idbag &= attribute node { text }?
attlist.idbag &=
[ a:defaultValue = "true" ] attribute embed-xml { "true" | "false" }?
\list =
element list {
attlist.list,
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,
(index | list-index),
(\element
| one-to-many
| many-to-many
| composite-element
| many-to-any),
loader?,
sql-insert?,
sql-update?,
sql-delete?,
sql-delete-all?,
filter*
}
attlist.list &= attribute name { text }
attlist.list &= attribute access { text }?
attlist.list &= attribute table { text }?
# default: name
attlist.list &= attribute schema { text }?
# default: none
attlist.list &= attribute catalog { text }?
# default: none
attlist.list &= attribute subselect { text }?
attlist.list &= attribute lazy { "true" | "false" | "extra" }?
attlist.list &=
[ a:defaultValue = "false" ] attribute inverse { "true" | "false" }?
attlist.list &=
[ a:defaultValue = "true" ] attribute mutable { "true" | "false" }?
attlist.list &= attribute cascade { text }?
attlist.list &= attribute where { text }?
# default: none
attlist.list &= attribute batch-size { text }?
attlist.list &= attribute outer-join { "true" | "false" | "auto" }?
attlist.list &= attribute fetch { "join" | "select" | "subselect" }?
attlist.list &= attribute persister { text }?
attlist.list &= attribute collection-type { text }?
attlist.list &= attribute check { text }?
# default: none
attlist.list &=
[ a:defaultValue = "true" ]
attribute optimistic-lock { "true" | "false" }?
# only supported for properties of a class (not component)
attlist.list &= attribute node { text }?
attlist.list &=
[ a:defaultValue = "true" ] attribute embed-xml { "true" | "false" }?
array =
element array {
attlist.array,
meta*,
subselect?,
cache?,
synchronize*,
comment?,
key,