blob: a9984606e7fc52c198915c860b0cc157d3c2636b [file] [log] [blame]
Title: Reverse Engineer Database
<H3><A name="ReverseEngineerDatabase-ReverseEngineerDatabase"></A>Reverse Engineer Database</H3>
<P><B>Start Reverse Engineering.</B> To reverse engineer a database you need to select either a DataDomain or one of its children on the project tree. Then select &quot;Tools &gt; Reengineer Database Schema&quot; from the menu. &quot;Connect to Database&quot; dialog will be presented.</P>
<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cayenne.apache.org/docs/1.2/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>Reverse-engineering behavior is sensitive to the current project tree selection. If you selected a DataDomain or a DataNode, a new DataMap will be created and all reengineered tables will be put in this DataMap. If you had an existing DataMap (or one of its entities) selected when you started reverse engineering, new tables will be merged into the existing DataMap.</TD></TR></TABLE></DIV>
<P><B>Configure Database Connection.</B> &quot;Connect to Database&quot; dialog allows to specify alternative connection parameters. If a DataNode was selected when reverse engineering started, its connection information is shown by default. You can use suggested default connection, select one of the stored local DataSources from &quot;Saved DataSources&quot; dropdown (those can be edited on the spot by clicking &quot;...&quot; button), or type your own info. When desired connection is selected, click &quot;Continue&quot;. Cayenne will attempt to connect to the database and if connection is successful, &quot;Select Options&quot; dialog is presented.</P>
<P><SPAN class="image-wrap" style=""><IMG src="reverse-engineer-database.data/reengineer-connect.jpg" style="border: 0px solid black"></SPAN></P>
<P><B>Configure Options.</B> &quot;Select Options&quot; dialog allows to specify what needs to be reverse engineered. If a database supports schemas, one of the listed schemas should be selected. Table and stored procedure patterns allow to control which tables/procedures are included in reverse engineering. Patterns should be in the format used by SQL LIKE clause (e.g. &quot;ABC&quot;, &quot;ABC%&quot; or&quot; %&quot; or &quot;A%T&quot;, etc.).</P>
<P>After desired options are selected, click &quot;Continue&quot;. Progress dialog will open. It will close automatically when reverse-engineering is done. After that all database tables and stored procedures that matched selected criteria will be added to the DataMap. Default ObjEntity mapping will be created as well.</P>
<P><SPAN class="image-wrap" style=""><IMG src="reverse-engineer-database.data/reengineer-schema.jpg" style="border: 0px solid black"></SPAN></P>