| <!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 2.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-2.0/. 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-04-05T12:21:37Z" /> |
| <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><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 > Generate Dynamic Entities from Tables</span>.</p> |
| <img src="img/generate_dynamic_entities.png" alt="JPA Tools > Generate Dynamic Entities from Tables" title="JPA Tools > 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"> |
| <?xml version="1.0" encoding="UTF-8"?> |
| <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"> |
| <entity class="quickstart.demo.model.Inventory" <span class="bold">access="VIRTUAL"</span>> |
| <attributes> |
| <id name="itemSku" attribute-type="long"> |
| |
| </id> |
| </attributes> |
| </entity> |
| <entity ..."> |
| </entity> |
| </entity-mappings> |
| </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 © 2011, 2013, Oracle and/or its affiliates. All rights reserved.</span><br /> |
| <a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> |
| </tr> |
| </table> |
| </div> |
| <!-- class="footer" --> |
| </body> |
| </html> |