blob: d3c7c7ee597c4d1202f2cca2fd8b90174f3d14eb [file] [log] [blame]
Title: Create DataNode
<H3><A name="CreateDataNode-CreateDataNode"></A>Create DataNode</H3>
<P><B>Create DataNode.</B> DataNodes are created under parent DataDomains. To create a DataNode, select one of the DataDomains on the left-hand side, and then select &quot;<TT>Project -&gt; Create DataNode</TT>&quot; menu item or click on &quot;New DataNode&quot; icon. A new DataNode will be created under the selected domain. After the DataNode is created, you can assign it any name you want instead of the default &quot;[DomainName]Node&quot;. </P>
<P><SPAN class="image-wrap" style=""><IMG src="create-datanode.data/datanode.jpg" style="border: 0px solid black"></SPAN></P>
<P><B>Configure DB Adapter.</B> As mentioned <A href="dbadapter.html" title="DbAdapter">in Cayenne User Guide</A>, RDBMS engines sometimes require special handling outside of standard JDBC scope. Cayenne abstracts it via database-specific adapters. An adapter must be selected from a &quot;DB adapter&quot; dropdown, regardless what type of DataSource factory (see below) is used . Standard adapters distributed with Cayenne (including a generic JDBCAdapter) are listed in the dropdown. If you created your own adapter, type the full class name of a class that implements DbAdapter interface instead. </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><B>Hint</B><BR>If entering custom DbAdapter results in Modeler showing a warning, it is likely a CLASSPATH issue. In this case you will need to setup the location of compiled custom adapter classes in &quot;Tools &gt; Preferences &gt; ClassPath&quot;.</TD></TR></TABLE></DIV>
<P><B>Select Local DataSource.</B> This is an optional, though recommended step. A &quot;Local DataSource&quot; dropdown allows to create an association between a DataNode and a <A href="local-datasources.html" title="Local DataSources">previously configured DataSources</A>. Such association is transparently stored as one of the preferences and does not affect your project XML files. This is a good way to separate database connection info stored in a given Cayenne project (i.e. deployment information) from local preferred connection settings. Also it allows to connect using JNDI DataNodes.</P>
<P><B>Configure DataSource Factory.</B> Depending on how you plan to deploy your Cayenne project, make a selection from the &quot;DataSource Factory&quot; dropdown. Select JNDIDataSourceFactory if you plan to obtain DataSource via JNDI from deployment container. If you either have a standalone application or want Cayenne to handle connection pooling, select DriverDataSourceFactory (default). A custom factory can also be used. </P>
<P><B>Configure DataSource Information (Driver factory only).</B> Depending on the type of DataSource Factory selected, bottom right area of the screen will change to show a form appropriate for a selected type of DataSource. It allows to enter JDBC information for DriverDataSourceFactory or JNDI name for JNDI. If custom DataSource Factory was selected, an optional string parameter can be entered (it can be anything that a custom DataSource factory understands).</P>