Skip to main content
summaryrefslogtreecommitdiffstats
blob: 45f650583b5f36fc9b0ed2f1d235454c3d70f0cd (plain) (blame)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="Apache Forrest" name="Generator">
<meta name="Forrest-version" content="0.7">
<meta name="Forrest-skin-name" content="elver4">
<style type="text/css">
          /*  */
          @import "../skin/tigris.css";
          @import "../skin/quirks.css";
          @import "../skin/inst.css";
         /*   */
        </style>
<link media="print" href="../skin/print.css" type="text/css" rel="stylesheet">
<link href="../skin/forrest.css" type="text/css" rel="stylesheet">
<link rel="shortcut icon" href="../">
<script type="text/javascript" src="../skin/tigris.js"></script><script src="../skin/menu.js" language="javascript" type="text/javascript"></script>
<title>Supported JPA Annotation Features</title>
<meta content="text/css" http-equiv="Content-style-type">
</head>
<body class="composite" onload="focus()">
<div id="banner">
<table width="100%" cellpadding="8" cellspacing="0" border="0">
<tr>
<td align="left">
<div>
<a href="http://www.elver.org"><img class="logoImage" alt="Elver Store" src="../images/ELV2.gif"></a>
</div>
<span class="alt">Elver Store</span></td><td align="center">
<div>
<a href="http://www.elver.org/"><img class="logoImage" alt="Elver" src="../images/empty.gif"></a>
</div>
</td><td valign="top" align="right">
<div class="right" align="right" id="login">
<form target="_blank" action="http://www.google.com/search" method="get">
<select name="as_sitesearch"><option value="">Search...</option><option value="www.elver.org">The elver site</option><option value="">The web</option></select> for
		      <input size="15" name="as_q" id="query" type="text"><input name="Search" value="Go" type="submit">
</form>
</div>
</td>
</tr>
</table>
</div>
<div id="toptabs" class="tabs">
<table border="0" cellspacing="0" cellpadding="4">
<tr>
<td><a class="base-selected" href="../index.html">Home</a></td><th><a class="base-selected" href="../hibernate/index.html">EMF Hibernate</a></th><td><a class="base-selected" href="../jpox/index.html">EMF JDO/JPOX</a></td><td><a class="base-selected" href="../services/index.html">Services</a></td>
</tr>
</table>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="breadcrumbs">
<tr>
<td></td><td>
<div class="published" align="right">
<script type="text/javascript" language="JavaScript"><!--
                 document.write("Published: " + document.lastModified);
                 //  --></script>
</div>
</td>
</tr>
</table>
<table id="main" width="100%" cellpadding="4" cellspacing="0" border="0">
<tr valign="top">
<td style="padding: 0px" width="20%" id="leftcol">
<table width="100%" class="menuarea" cellspacing="0" cellpadding="0">
<tr>
<td width="6px" valign="top">
<table border="0" cellpadding="0" cellspacing="0" class="leftpagemargin">
<tr>
<td class="subborder trail">&nbsp;</td>
</tr>
</table>
</td><td class="dialog">
<div class="menu">
<div onclick="SwitchMenu('menu_1.1')" id="menu_1.1Title" class="menutitle">Home</div>
<div id="menu_1.1" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/index.html">Introduction</a>
</div>
<div class="menuitem">
<a href="../hibernate/status.html">Status</a>
</div>
<div class="menuitem">
<a href="../hibernate/features.html">Features</a>
</div>
<div class="menuitem">
<a href="../hibernate/overview.html">Overview</a>
</div>
<div class="menuitem">
<a href="../hibernate/changelog.html">Changelog</a>
</div>
<div class="menuitem">
<a href="../hibernate/installation.html">Download &amp; Install</a>
</div>
<div class="menuitem">
<a href="../hibernate/knownissues.html">Known Issues</a>
</div>
<div class="menuitem">
<a href="../hibernate/quick_tutorial.html">Quick Start</a>
</div>
<div class="menuitem">
<a href="../hibernate/license.html">License</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.2')" id="menu_1.2Title" class="menutitle">Library Tutorial</div>
<div id="menu_1.2" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/tutorialone/tutorial1_intro.html">Introduction</a>
</div>
<div class="menuitem">
<a href="../hibernate/tutorialone/tutorial1_1.html">Setup Environment</a>
</div>
<div class="menuitem">
<a href="../hibernate/tutorialone/tutorial1_2.html">Create and Store EMF Object</a>
</div>
<div class="menuitem">
<a href="../hibernate/tutorialone/tutorial1_3.html">Retrieve EMF Objects</a>
</div>
<div class="menuitem">
<a href="../hibernate/tutorialone/tutorial1_4.html">Query EMF Objects</a>
</div>
<div class="menuitem">
<a href="../hibernate/tutorialone/tutorial1_5.html">Using EMF/JPOX Resources</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.3')" id="menu_1.3Title" class="menutitle">Library Editor Tutorial</div>
<div id="menu_1.3" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/tutorialtwo/tutorial2_intro.html">Introduction</a>
</div>
<div class="menuitem">
<a href="../hibernate/tutorialtwo/tutorial2_1.html">Initialize the Library Editor</a>
</div>
<div class="menuitem">
<a href="../hibernate/tutorialtwo/tutorial2_2.html">Run the Library Editor</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.4')" id="menu_1.4Title" class="menutitle">GMF Editor Tutorial</div>
<div id="menu_1.4" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/gmftutorial/tutorial1.html">Introduction</a>
</div>
<div class="menuitem">
<a href="../hibernate/gmftutorial/tutorial2.html">Environment Setup</a>
</div>
<div class="menuitem">
<a href="../hibernate/gmftutorial/tutorial3.html">Running the editor</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.5')" id="menu_1.5Title" class="menutitle">Details</div>
<div id="menu_1.5" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/dynamic.html">Dynamic EMF Tutorial</a>
</div>
<div class="menuitem">
<a href="../hibernate/inheritance.html">Inheritance Mapping</a>
</div>
<div class="menuitem">
<a href="../hibernate/hibernate_relations.html">Modeling Associations</a>
</div>
<div class="menuitem">
<a href="../hibernate/hbdatastore.html">HbDataStore</a>
</div>
<div class="menuitem">
<a href="../hibernate/options.html">Options</a>
</div>
<div class="menuitem">
<a href="../hibernate/hibernate_details.html">EMF - Hibernate Details</a>
</div>
<div class="menuitem">
<a href="../hibernate/hibernateresources.html">EMF Hibernate Resources</a>
</div>
<div class="menuitem">
<a href="../hibernate/resource_utility.html">Resource Utility</a>
</div>
<div class="menuitem">
<a href="../hibernate/troubleshooting.html">Troubleshooting</a>
</div>
</div>
<div onclick="SwitchMenu('menu_selected_1.6')" id="menu_selected_1.6Title" class="menutitle">Annotations (JPA/EJB3)</div>
<div id="menu_selected_1.6" class="selectedmenuitemgroup">
<div class="menuitem">
<a href="../hibernate/ejb3_format.html">Format</a>
</div>
<div class="menuitem">
<a href="../hibernate/ejb3_examples.html">Examples</a>
</div>
<div class="menupage">
<div class="menupagetitle">JPA/EJB3</div>
</div>
</div>
<div onclick="SwitchMenu('menu_1.7')" id="menu_1.7Title" class="menutitle">XML Schema</div>
<div id="menu_1.7" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/features_details.html">XML Schema Support</a>
</div>
<div class="menuitem">
<a href="../hibernate/schema_list.html">XML Schema Examples</a>
</div>
<div class="menuitem">
<a href="../hibernate/featuremap.html">Feature Map/Mixed Content</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.8')" id="menu_1.8Title" class="menutitle">Support</div>
<div id="menu_1.8" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/upgrading.html">Upgrading</a>
</div>
<div class="menuitem">
<a href="../hibernate/mailinglist.html">Newsgroup</a>
</div>
<div class="menuitem">
<a href="../hibernate/emfhibsupport.html">EMF/Hibernate Support</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.9')" id="menu_1.9Title" class="menutitle">Developer</div>
<div id="menu_1.9" class="menuitemgroup">
<div class="menuitem">
<a href="../hibernate/svn.html">CVS</a>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td></td><td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="border bottom-left"></td><td class="border bottomborder"></td><td class="border bottom-right"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" height="10"></td>
</tr>
</table>
<table></table>
<table></table>
<div class="strut">&nbsp;</div>
</td><td>
<div class="content">
<div id="bodycol">
<div id="apphead">
<h2>
<em>Supported JPA Annotation Features</em>
</h2>
</div>
<div class="app" id="projecthome">
<ul class="minitoc">
<li>
<a href="#featuresejb3">JPA Annotation Features</a>
</li>
<li>
<a href="#Supported+JPA+Annotations">Supported JPA Annotations</a>
</li>
<li>
<a href="#Currently+Unsupported+JPA+Annotations">Currently Unsupported JPA Annotations</a>
</li>
<li>
<a href="#hbspecific">Hibernate Annotations Extensions</a>
</li>
<li>
<a href="#Annotation+notes">Annotation notes</a>
<ul class="minitoc">
<li>
<a href="#edatatype">Annotations on EDataType</a>
</li>
<li>
<a href="#transient">Transient on EClass</a>
</li>
<li>
<a href="#Unique+annotation+added+to+OneToMany+to+force+a+join+table+for+1%3An+relations">Unique annotation added to OneToMany to force a join table for 1:n relations</a>
</li>
<li>
<a href="#indexed">Indexed Annotation</a>
</li>
<li>
<a href="#EmbeddedID+annotation">EmbeddedID annotation</a>
</li>
<li>
<a href="#lob_notes">Lob annotation</a>
</li>
<li>
<a href="#EMF+ID+Attribute">EMF ID Attribute</a>
</li>
<li>
<a href="#Extra+CASCADE+type%3A+NONE">Extra CASCADE type: NONE</a>
</li>
</ul>
</li>
</ul>
		
<a name="N1000E"></a><a name="featuresejb3"></a>
<div class="h3">
<h3>JPA Annotation Features</h3>
			
			
<p>The goal is to support all JPA persistence annotations.</p>
			
<p>You can download the EJB 3.0 Persistence Specification from the
				<a class="external" href="http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html">jsr-220 download page</a>. The
				relevant document is "ejb-3_0-fr-spec-persistence.pdf".</p>
			
<p>The numbers in the listings below refer to the sections in chapter 9 of the specification.</p>
		
</div>
		
<a name="N10022"></a><a name="Supported+JPA+Annotations"></a>
<div class="h3">
<h3>Supported JPA Annotations</h3>
			
			
<p>The JPA annotations listed below are supported as of the current release. "Supported" means that there are test
				cases showing the annotation is correctly translated to an object-relational mapping and that the annotation works as
				expected when persisting and retrieving objects to/from a database.</p>
			
<p>Supported as of the current release:</p>
				
<ul>
				
<li>9.1.1 Table Annotation</li>
				
<li>9.1.2: SecondaryTable Annotation</li>
				
<li>9.1.3: SecondaryTables Annotation</li>
				
<li>9.1.4: UniqueConstraint Annotation</li>
				
<li>9.1.5: Column Annotation</li>
				
<li>9.1.6: JoinColumn Annotation</li>
				
<li>9.1.7: JoinColumns Annotation</li>
				
<li>9.1.8: Id Annotation</li>
				
<li>9.1.9: GeneratedValue Annotation</li>
				
<li>9.1.10: AttributeOverride Annotation</li>
				
<li>9.1.11: AttributeOverrides Annotation</li>
				
<li>9.1.12: AssociationOverride Annotation</li>
				
<li>9.1.13: AssociationOverrides Annotation</li>
				
<li>9.1.14: EmbeddedId Annotation</li>
				
<li>9.1.15: IdClass Annotation</li>
				
<li>9.1.16: Transient Annotation</li>
				
<li>9.1.17: Version Annotation</li>
				
<li>9.1.18: Basic Annotation</li>
				
<li>9.1.19: Lob Annotation</li>
				
<li>9.1.20: Temporal Annotation (no special support required, handled automatically)</li>
				
<li>9.1.21: Enumerated Annotation (the Enumerate class must have a get(int) and get(String) method which returns an instance of the Enumerate class)</li>
				
<li>9.1.22: ManyToOne Annotation</li>
				
<li>9.1.23: OneToOne Annotation</li>
				
<li>9.1.24: OneToMany Annotation</li>
				
<li>9.1.25: JoinTable Annotation</li>
				
<li>9.1.26: ManyToMany Annotation</li>
				
<li>9.1.28: OrderBy Annotation (the annotation should contain the column name and not the property name)</li>
				
<li>9.1.29: Inheritance Annotation</li>
				
<li>9.1.30: DiscriminatorColumn Annotation</li>
				
<li>9.1.31: Discriminator Annotation</li>
				
<li>9.1.32: PrimaryKeyJoinColumn Annotation</li>
				
<li>9.1.33: PrimaryKeyJoinColumns Annotation</li>
				
<li>9.1.34: Embeddable Annotation</li>
				
<li>9.1.35: Embedded Annotation</li>
				
<li>9.1.36: MappedSuperclass Annotation</li>
				
<li>9.1.37: SequenceGenerator Annotation</li>
				
<li>9.1.38: TableGenerator Annotation</li>
				
</ul>
			
</div>
			
<a name="N100A1"></a><a name="Currently+Unsupported+JPA+Annotations"></a>
<div class="h3">
<h3>Currently Unsupported JPA Annotations</h3>
				
				
<p>The following annotations are not yet supported:</p>
				
<ul>
				
<li>9.1.27: MapKey Annotation</li>
				
</ul>
		
</div>
		
<a name="N100B1"></a><a name="hbspecific"></a>
<div class="h3">
<h3>Hibernate Annotations Extensions</h3>
			
			
<p>In addition to the JPA annotations, Teneo supports a number of 
			<a class="external" href="http://www.hibernate.org/5.html#A7">Hibernate Annotations Extensions</a>.</p>
			
<p>The following Hibernate specific annotations are supported:</p>
			
<ul>
				
<li>Cache</li>
				
<li>Columns</li>
				
<li>Fetch</li>
				
<li>GenericGenerator</li>
				
<li>IdBag</li>
				
<li>Type (on EAttribute)</li>
				
<li>TypeDef (on EDataType)</li>
			
</ul>
			
<p>In future releases the support for hibernate specific annotations will be extended.</p>
		
</div>
		
<a name="N100DD"></a><a name="Annotation+notes"></a>
<div class="h3">
<h3>Annotation notes</h3>
			
			
<a name="N100E3"></a><a name="edatatype"></a>
<div class="h4">
<h4>Annotations on EDataType</h4>
<p>Every JPA annotation which is relevant for a non-reference type java member can also be specified on an EDataType. 
			Setting annotations on an EDataType has as advantage that the annotation is used in every location in which the EDataType is
			used. For example the column length annotation can be defined on EDataType level and is then automatically added to 
			each EAttribute which uses this EDataType. The annotations on EAttribute level take precedence so if both the EAttribute 
			and the EDataType have the same annotation then the annotation on the EAttribute is used.</p>
</div>
			
<a name="N100EC"></a><a name="transient"></a>
<div class="h4">
<h4>Transient on EClass</h4>
<p>The Transient annotation can also be used on an EClass. This prevents an EClass from being mapped and be persisted.</p>
<p>This means also that in case that the super EClass of an EClass is transient that the properties of the super EClass are 
				not persisted and that the sub EClass requires its own identifier/primary key properties.</p>
</div>
		
		
<a name="N100F9"></a><a name="Unique+annotation+added+to+OneToMany+to+force+a+join+table+for+1%3An+relations"></a>
<div class="h4">
<h4>Unique annotation added to OneToMany to force a join table for 1:n relations</h4>
<p>In a relational database 1:n relations are often modeled by adding a foreign-key (to the 
		parent) in the child table/object. The disadvantage of this approach is that duplicates 
		are not supported. To support duplicates in an elist a join table is required. To signal to 
		Teneo, that a join table should be used, the annotation as in this example can be used:</p>
<pre class="code">
&lt;xsd:element name="joinedItem" type="xsd:anyURI" ecore:reference="this:Item" maxOccurs="unbounded"&gt;
	&lt;xsd:annotation&gt;
		&lt;xsd:appinfo source="teneo.jpa"&gt;@OneToMany(unique=false)&lt;/xsd:appinfo&gt;
	&lt;/xsd:annotation&gt;
&lt;/xsd:element&gt;
			</pre>
<p>Based on this annotations Teneo will generate a join table for this model. Note that 
		this annotation can be combined with the indexed annotation.</p>
<p>
<em>The unique annotation does not exist in the EJB3 spec and is a Teneo extension.</em>
</p>
</div>
		
		
<a name="N1010D"></a><a name="indexed"></a>
<div class="h4">
<h4>Indexed Annotation</h4>
<p>The http://annotation.elver.org/Indexed annotation can be used to signal to Elver that a certain association does
		not require an index column and has a bag like behavior. 
		See <a href="hibernate_relations.html#Mapping+non-indexed+relations">here</a>
		for more information.</p>
</div>
			
			
<a name="N1011A"></a><a name="EmbeddedID+annotation"></a>
<div class="h4">
<h4>EmbeddedID annotation</h4>
<p>EmbeddedID lets you use an embedded class as an entity's composite primary key.</p>
<p>
<em>Note: in general, composite primary keys are only necessary for legacy data models.
					It's strongly recommended to use single (non-composite) keys for new data models.</em>
</p>
<p>Teneo requires that the composite key's class is an EObject, as it needs ECore metadata to define the correct mapping.</p>
</div>
			
			
<a name="N1012B"></a><a name="lob_notes"></a>
<div class="h4">
<h4>Lob annotation</h4>
<p>
					Some database engines - for example, MySQL - have different BLOB types for different data sizes.
					(TINYBLOB, MEDIUMBLOB, LARGEBLOB.) 
				</p>
<p>The actual BLOB type used by Hibernate is thus dependent upon the column length, but the default
					column length of 255 is often too small to acommodate typical BLOB data. </p>
<p>Therefore you'll need to add a Column.length annotation to the property specifying the maximum possible size of the BLOB data, as shown below:</p>
<pre class="code">
&lt;xsd:element name="photo" type="xsd:base64Binary" minOccurs="0"&gt;
	&lt;xsd:annotation&gt;
		&lt;!-- Map to a 'binary' field. --&gt;
		&lt;xsd:appinfo source="teneo.jpa"&gt;
			@Lob
			&lt;!-- Use 1Mb maximum length. (MEDIUMBLOB in MySQL.) --&gt;
			@Column(length=1048576)
		&lt;/xsd:appinfo&gt;
	&lt;/xsd:annotation&gt;
&lt;/xsd:element&gt;
				</pre>
</div>
						
<a name="N1013F"></a><a name="EMF+ID+Attribute"></a>
<div class="h4">
<h4>EMF ID Attribute</h4>
<p>When an eattribute has its ID property set to true and there is no @Id annotated eattribute in the 
			eclass then the ID eattribute is used. This default behavior can be changed using the option:
			<a href="options.html">ID_FEATURE_AS_PRIMARY_KEY</a>.</p>
</div>
			
<a name="N1014C"></a><a name="Extra+CASCADE+type%3A+NONE"></a>
<div class="h4">
<h4>Extra CASCADE type: NONE</h4>
<p>Teneo will automatically set the cascade annotation when no cascade annotation has been set on an 
			assocation. To also support no-cascading behavior the additional CascadeType NONE is supported by
			Teneo.</p>
</div>
			
		
</div>
		
	
</div>
</div>
</div>
</td>
</tr>
</table>
<div width="100%" id="footer">
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td class="footer"><a href="license.html">
          Copyright &copy; 2007 The Elver Project</a>
      - All rights reserved.
      </td>
</tr>
</table>
</div>
</body>
</html>

Back to the top