Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 20bee5f231b8c87e938f4f5a82bb46f4bdfdc57e (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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Generating dynamic entities from tables</title>
<meta name="copyright" content="Copyright (c) 2000, 2009 oracle . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: Oracle - initial API and implementation" />
<meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 1.0.11" />
<meta name="date" content="2013-01-03T9:24:53Z" />
<meta name="robots" content="noarchive" />
<meta name="doctitle" content="Generating dynamic entities from tables" />
<meta name="relnum" content="Release 3.3" />
<meta name="partnum" content="Release 3.3" />
<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" />
</head>
<body>
<p class="betadraftsubtitle">Beta Draft: 2013-01-03</p>
<p><a id="CIHHFGIG" name="CIHHFGIG"></a></p>
<div class="sect1"><!-- infolevel="all" infotype="General" -->
<h1>Generating dynamic entities from tables</h1>
<p><a id="sthref307" name="sthref307"></a><a id="sthref308" name="sthref308"></a><a id="sthref309" name="sthref309"></a><a id="sthref310" name="sthref310"></a>When using EclipseLink JPA, you can create dynamic entities from your database tables. This dynamic persistence provides access to a relational database with all the benefits of JPA <span class="italic">without coding</span> or maintaining Java classes.</p>
<p>Dali dynamically creates the classes at runtime, as needed.</p>
<p>To generate dynamic entities:</p>
<ol>
<li>
<p>Right-click the JPA project in the <span class="gui-object-title">Project Explorer</span> and select <span class="gui-object-action">JPA Tools &gt; Generate Dynamic Entities from Tables</span>.</p>
<img src="img/generate_dynamic_entities.png" alt="JPA Tools &gt; Generate Dynamic Entities from Tables" title="JPA Tools &gt; Generate Dynamic Entities from Tables" /><br />
<p>The Select Tables page of the <a href="reference002.htm#CACGDFDJ">Generate Dynamic Entities from Tables wizard</a> appears.</p>
<div class="figure"><a id="sthref311" name="sthref311"></a>
<p class="titleinfigure">Select Tables</p>
<img src="img/select_tables_dynamic.png" alt="" title="" /><br /></div>
<!-- class="figure" --></li>
<li>
<p>On the <a href="reference003.htm#CACFGHJF">Select Tables</a> page, select the tables from which to generate the entities and click <span class="bold">Next</span>.</p>
<p>The <a href="reference004.htm#CACBDJAC">Table Associations</a> page appears.</p>
<div class="figure"><a id="sthref312" name="sthref312"></a>
<p class="titleinfigure">Table Associations</p>
<img src="img/table_associations_dynamic.png" alt="" title="" /><br /></div>
<!-- class="figure" --></li>
<li>
<p>On the <a href="reference004.htm#CACBDJAC">Table Associations</a> page, specify which table associations should be generated. Use the <a href="ref_create_new_association_wizard.htm#CIAFGHIF">Create New Association wizard</a> to create additional relationships.</p>
<p>Click <span class="bold">Next</span>. The <a href="reference005.htm#CACHHEEH">Customize Default Entity Generation</a> page appears.</p>
<div class="figure"><a id="sthref313" name="sthref313"></a>
<p class="titleinfigure">Customize Defaults</p>
<img src="img/customize_default_entity_generation_dynamic.png" alt="" title="" /><br /></div>
<!-- class="figure" --></li>
<li>
<p>On the <a href="reference005.htm#CACHHEEH">Customize Default Entity Generation</a> page, specify the default information to use when generating the entities, and click <span class="bold">Next</span>.</p>
<p>The <a href="reference006.htm#CACDGDIC">Customize Individual Entities</a> page appears.</p>
<div class="figure"><a id="sthref314" name="sthref314"></a>
<p class="titleinfigure">Customize Individual Entities</p>
<img src="img/customize_individual_entities_dynamic.png" alt="" title="" /><br /></div>
<!-- class="figure" --></li>
<li>
<p>Use the <a href="reference006.htm#CACDGDIC">Customize Individual Entities</a> page to customize specific generated entities.</p>
</li>
<li>
<p>Click <span class="bold">Finish</span> to complete the wizard and generate the entities.</p>
</li>
</ol>
<p>Dali generates the dynamic entities, using the <code>VIRTUAL</code> access type, as shown in <a href="#CIHIDHAB">Example: Sample eclipselink-orm.xml File with Dynamic Entities</a>.</p>
<div class="example"><a id="CIHIDHAB" name="CIHIDHAB"></a>
<p class="titleinexample"><a id="sthref315" name="sthref315"></a>Sample eclipselink-orm.xml File with Dynamic Entities</p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;entity-mappings version="2.4" xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_4.xsd"&gt;
    &lt;entity class="quickstart.demo.model.Inventory" <span class="bold">access="VIRTUAL"</span>&gt;
        &lt;attributes&gt;
            &lt;id name="itemSku" attribute-type="long"&gt;

            &lt;/id&gt;
        &lt;/attributes&gt;
    &lt;/entity&gt;
    &lt;entity ..."&gt;
    &lt;/entity&gt;
&lt;/entity-mappings&gt;
</pre></div>
<!-- class="example" --></div>
<!-- class="sect1" -->
<!-- Start Footer -->
<div class="footer">
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<col width="86%" />
<col width="*" />
<tr>
<td align="left"><span class="copyrightlogo">Copyright&nbsp;&copy;&nbsp;2011, 2013,&nbsp;Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp;All&nbsp;rights&nbsp;reserved.</span><br />
<a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td>
</tr>
</table>
</div>
<!-- class="footer" -->
</body>
</html>

Back to the top