Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Using Workbench (ELUG)"

m (How to Create the loginspec Task)
m
 
(42 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
[[Image:Elug draft icon.png]] '''For the latest EclipseLink documentation, please see http://www.eclipse.org/eclipselink/documentation/ '''
 +
 +
----
 +
 
<div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__
 
<div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__
 
[[Special:Whatlinkshere/Using Workbench (ELUG)|Related Topics]]</div>
 
[[Special:Whatlinkshere/Using Workbench (ELUG)|Related Topics]]</div>
Line 8: Line 12:
 
==Introduction to the Workbench==
 
==Introduction to the Workbench==
 
Workbench is a separate component from the EclipseLink runtime – it lets you graphically configure descriptors and map your project. Workbench can verify the descriptor options, access the data source (either a database or an XML schema), and create the database schema. Using Workbench, you can define EclipseLink descriptors and configurations ''without using code''.
 
Workbench is a separate component from the EclipseLink runtime – it lets you graphically configure descriptors and map your project. Workbench can verify the descriptor options, access the data source (either a database or an XML schema), and create the database schema. Using Workbench, you can define EclipseLink descriptors and configurations ''without using code''.
 +
 +
The Workbench is primarily for developing when using the native EclipseLink API, MOXy, or EIS. When using JPA, other development tools such as Eclipse Dali, or Oracle JDeveloper can be used.
  
 
You can use Workbench during the ''development'' phase of the [[Introduction to EclipseLink Application Development (ELUG)|development process]]. Typically, this phase includes the following:
 
You can use Workbench during the ''development'' phase of the [[Introduction to EclipseLink Application Development (ELUG)|development process]]. Typically, this phase includes the following:
Line 21: Line 27:
  
 
For more information on using Workbench as the development environment, see [[Introduction%20to%20EclipseLink%20Development%20Tools%20(ELUG)|Introduction to EclipseLink Development Tools]].
 
For more information on using Workbench as the development environment, see [[Introduction%20to%20EclipseLink%20Development%20Tools%20(ELUG)|Introduction to EclipseLink Development Tools]].
 
 
  
 
==Configuring the Workbench Environment==
 
==Configuring the Workbench Environment==
Line 33: Line 37:
 
# Ensure that the <tt>JAVA_HOME</tt> environment variable is set:
 
# Ensure that the <tt>JAVA_HOME</tt> environment variable is set:
 
#* For Windows: <tt>set JAVA_HOME=C:/j2sdk1.5.0_04</tt>
 
#* For Windows: <tt>set JAVA_HOME=C:/j2sdk1.5.0_04</tt>
#* For UNIX: <tt>JAVA_HOME=/usr/local/packages/java; export JAVA_HOME</tt>
+
#* For UNIX: <tt>JAVA_HOME=/usr/local/packages/java; export JAVA_HOME</tt><br>'''Note''': If you have already set JAVA_HOME as a system environment variable, you can skip this step.
 
# Update the <tt>DRIVER_CLASSPATH</tt> environment variable to add the location of the following (if necessary):<br>'''Note''': Do not include any Java classes for your persistent business objects in the <tt>DRIVER_CLASSPATH</tt> variable. Instead, add these persistent business objects in your [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Workbench project classpath]].
 
# Update the <tt>DRIVER_CLASSPATH</tt> environment variable to add the location of the following (if necessary):<br>'''Note''': Do not include any Java classes for your persistent business objects in the <tt>DRIVER_CLASSPATH</tt> variable. Instead, add these persistent business objects in your [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Workbench project classpath]].
 
#* JDBC drivers  –  if you are using [[Introduction%20to%20Relational%20Projects%20(ELUG)#Building Relational Projects|building Relational Projects]].
 
#* JDBC drivers  –  if you are using [[Introduction%20to%20Relational%20Projects%20(ELUG)#Building Relational Projects|building Relational Projects]].
 
#* Java EE Connector Architecture (JCA) adapters  –  if you are [[Introduction%20to%20EIS%20Projects%20(ELUG)#EIS Project Concepts|Building EIS projects]].
 
#* Java EE Connector Architecture (JCA) adapters  –  if you are [[Introduction%20to%20EIS%20Projects%20(ELUG)#EIS Project Concepts|Building EIS projects]].
#* JCA <tt>connector.jar</tt> file  –  if you are using [[Introduction%20to%20EIS%20Projects%20(ELUG)#EIS Project Concepts|EIS Projects]].<br>The <tt>connector.jar</tt> file contains <tt>javax.resource.cci</tt> and <tt>javax.resource.spi</tt> interfaces that EclipseLink EIS uses. Edit the <tt>workbench.cmd</tt> or <tt>workbench.sh</tt> file in <tt><</tt>''<tt>ECLIPSELINK_HOME</tt>''<tt>>/bin</tt> to change the path to this file.<br>At run time, this <tt>connector.jar</tt> file (or its equivalent) must be on your application or application server classpath.
+
#* JCA <tt>connector.jar</tt> file  –  if you are using [[Introduction%20to%20EIS%20Projects%20(ELUG)#EIS Project Concepts|EIS Projects]].<br>The <tt>connector.jar</tt> file contains <tt>javax.resource.cci</tt> and <tt>javax.resource.spi</tt> interfaces that EclipseLink EIS uses. Edit the <tt>workbench.cmd</tt> or <tt>workbench.sh</tt> file in <tt><</tt>''<tt>ECLIPSELINK_HOME</tt>''<tt>>/utils/workbench/bin</tt> to change the path to this file.<br>At run time, this <tt>connector.jar</tt> file (or its equivalent) must be on your application or application server classpath.
 
#* Oracle Database <tt>ORACLE_HOME/rdbms/jlib/xdb.jar</tt> file  –  if you are using  [[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-XMLType Mapping|Direct-to-XMLType Mappings]] with an Oracle9i or later database.
 
#* Oracle Database <tt>ORACLE_HOME/rdbms/jlib/xdb.jar</tt> file  –  if you are using  [[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-XMLType Mapping|Direct-to-XMLType Mappings]] with an Oracle9i or later database.
#* Custom <tt>Collection</tt> class that you use to override the default <tt>Collection</tt> class that EclipseLink uses with a [[Configuring%20a%20Mapping%20(ELUG)#Configuring Container Policy|mapping container policy]].  <br>The following examples shows how to set the <tt>DRIVER_CLASSPATH</tt> variable for Windows system and  for UNIX.<br><br>'''''Example: Setting DRIVER_CLASSPATH on Windows''''' <br><tt>set DRIVER_CLASSPATH=C:\OraHome\jdbc\lib\ojdbc14.jar;C:\Attunity\Connect\Java\lib\attunityResourceAdapter.jar;C:\OraHome\rdbms\jlib\xdb.jar</tt><br>'''Note''': If the path to your driver(s) contains spaces, you must enclose the path in double-quotes in the <tt>setenv.cmd</tt> file. For example:  <tt>set DRIVER_CLASSPATH="C:\Program Files\some directory\driver.jar\"</tt><br><br>'''''Example: Setting DRIVER_CLASSPATH on UNIX'''''<br><tt>DRIVER_CLASSPATH=/OraHome/jdbc/lib/ojdbc14.jar;/attunity/connect/java/lib/attunityResourceAdapter.jar;/OraHome/rdbms/jlib/xdb.jar; export JDBC_CLASSPATH</tt>
+
#* Custom <tt>Collection</tt> class that you use to override the default <tt>Collection</tt> class that EclipseLink uses with a [[Configuring%20a%20Mapping%20(ELUG)#Configuring Container Policy|mapping container policy]].  <br>The following examples shows how to set the <tt>DRIVER_CLASSPATH</tt> variable for Windows system and  for UNIX.<br><br>'''''Example: Setting DRIVER_CLASSPATH on Windows''''' <br><tt>set DRIVER_CLASSPATH=C:\OraHome\jdbc\lib\ojdbc14.jar;C:\Attunity\Connect\Java\lib\attunityResourceAdapter.jar;C:\OraHome\rdbms\jlib\xdb.jar</tt><br>'''Note''': If the path to your driver(s) contains spaces, you must enclose the path in double-quotes in the <tt>setenv.cmd</tt> file. For example:  <tt>set DRIVER_CLASSPATH="C:\Program Files\some directory\driver.jar"</tt><br><br>'''''Example: Setting DRIVER_CLASSPATH on UNIX'''''<br><tt>DRIVER_CLASSPATH=/OraHome/jdbc/lib/ojdbc14.jar;/attunity/connect/java/lib/attunityResourceAdapter.jar;/OraHome/rdbms/jlib/xdb.jar; export JDBC_CLASSPATH</tt>
 
# Save and close the <tt>setenv</tt> script.
 
# Save and close the <tt>setenv</tt> script.
 
+
# Start the Workbench by launching the ''<tt><ECLIPSELINK_HOME></tt>''<tt>\utils\workbench\bin\workbench.cmd</tt> or <tt>workbench.sh</tt> file.
To use Workbench in a language different than your default, add the <tt>-Duser.language</tt> and <tt>-Duser.country</tt> options to the <tt>JVM_ARGS</tt> variable in the <tt>workbench.cmd</tt> or <tt>.sh</tt> file. For example, the following arguments will start Workbench in US English, regardless of default language of your operating system:
+
JVM_ARGS="-Duser.language=en -Duser.country=en_US"
+
  
 
==Using Workbench==
 
==Using Workbench==
Line 59: Line 61:
 
# Editor window section: The '''Editor''' window section contains specific property sheets and option tabs for the currently selected object. See [[#How to Use the Editor|How to Use the Editor]] for more information.
 
# Editor window section: The '''Editor''' window section contains specific property sheets and option tabs for the currently selected object. See [[#How to Use the Editor|How to Use the Editor]] for more information.
 
# Problems window section: The '''Problems''' window section shows messages and errors for the currently selected object in the Navigator window section (see [[#How to Use the Problems Window|How to Use the Problems Window]]). [[EclipseLink Workbench Error Reference (ELUG)]] contains detailed information on each error message.
 
# Problems window section: The '''Problems''' window section shows messages and errors for the currently selected object in the Navigator window section (see [[#How to Use the Problems Window|How to Use the Problems Window]]). [[EclipseLink Workbench Error Reference (ELUG)]] contains detailed information on each error message.
 
  
  
Line 66: Line 67:
 
* Menu bar menus (see [[#Using Menu Bar Menus|Using Menu Bar Menus]])
 
* Menu bar menus (see [[#Using Menu Bar Menus|Using Menu Bar Menus]])
 
* Context menus (see [[#Using Context Menus|Using Context Menus]])
 
* Context menus (see [[#Using Context Menus|Using Context Menus]])
 
  
  
Line 77: Line 77:
  
 
[[Image:menubar.gif|Sample Menu Bar Menu]]<br><br>
 
[[Image:menubar.gif|Sample Menu Bar Menu]]<br><br>
 
  
  
Line 88: Line 87:
  
 
[[Image:popup.gif|Sample Context Menu]]<br><br>
 
[[Image:popup.gif|Sample Context Menu]]<br><br>
 
  
  
Line 97: Line 95:
  
 
Toolbars provide tool tips: each toolbar button provides a brief description when you position the mouse pointer over it.
 
Toolbars provide tool tips: each toolbar button provides a brief description when you position the mouse pointer over it.
 
  
  
Line 160: Line 157:
 
Close all
 
Close all
 
| headers="r8c1-t4 r1c3-t4" align="left" |
 
| headers="r8c1-t4 r1c3-t4" align="left" |
All
 
|- align="left" valign="top"
 
| id="r9c1-t4" headers="r1c1-t4" align="left" |
 
[[Image:helpbtn.gif|Online help]]<br>
 
| headers="r9c1-t4 r1c2-t4" align="left" |
 
Help topics
 
| headers="r9c1-t4 r1c3-t4" align="left" |
 
 
All
 
All
 
|- align="left" valign="top"
 
|- align="left" valign="top"
Line 172: Line 162:
 
[[Image:expxml.gif|Export Deployment XML button]]<br>
 
[[Image:expxml.gif|Export Deployment XML button]]<br>
 
| headers="r10c1-t4 r1c2-t4" align="left" |
 
| headers="r10c1-t4 r1c2-t4" align="left" |
Export deployment XML
+
Export deployment XML for the selected projects
 
| headers="r10c1-t4 r1c3-t4" align="left" |
 
| headers="r10c1-t4 r1c3-t4" align="left" |
 
Projects
 
Projects
Line 179: Line 169:
 
[[Image:refclsbt.gif|Refresh Selected Classes button]]<br>
 
[[Image:refclsbt.gif|Refresh Selected Classes button]]<br>
 
| headers="r11c1-t4 r1c2-t4" align="left" |
 
| headers="r11c1-t4 r1c2-t4" align="left" |
Refresh classes
+
Refreshes selected classes
 
| headers="r11c1-t4 r1c3-t4" align="left" |
 
| headers="r11c1-t4 r1c3-t4" align="left" |
 
Projects
 
Projects
Line 197: Line 187:
 
Projects
 
Projects
 
|}
 
|}
 
  
  
Line 239: Line 228:
 
[[Image:addtbldb.gif|Add or Update Tables from Database button]]<br>
 
[[Image:addtbldb.gif|Add or Update Tables from Database button]]<br>
 
| headers="r5c1-t5 r1c2-t5" align="left" |
 
| headers="r5c1-t5 r1c2-t5" align="left" |
Add or update tables from database
+
Add or update existing tables from database
 
| headers="r5c1-t5 r1c3-t5" align="left" |
 
| headers="r5c1-t5 r1c3-t5" align="left" |
 
Databases
 
Databases
Line 253: Line 242:
 
[[Image:remtable.gif|Remove Table button]]<br>
 
[[Image:remtable.gif|Remove Table button]]<br>
 
| headers="r7c1-t5 r1c2-t5" align="left" |
 
| headers="r7c1-t5 r1c2-t5" align="left" |
Remove table
+
Remove table or selected item
 
| headers="r7c1-t5 r1c3-t5" align="left" |
 
| headers="r7c1-t5 r1c3-t5" align="left" |
 
Database tables
 
Database tables
Line 260: Line 249:
 
[[Image:renambtn.gif|Rename button]]<br>
 
[[Image:renambtn.gif|Rename button]]<br>
 
| headers="r8c1-t5 r1c2-t5" align="left" |
 
| headers="r8c1-t5 r1c2-t5" align="left" |
Rename
+
Rename table or selected item
 
| headers="r8c1-t5 r1c3-t5" align="left" |
 
| headers="r8c1-t5 r1c3-t5" align="left" |
 
Database tables
 
Database tables
|- align="left" valign="top"
 
| id="r9c1-t5" headers="r1c1-t5" align="left" |
 
[[Image:dbrpbtn.gif|Add database platform button]]<br>
 
| headers="r9c1-t5 r1c2-t5" align="left" |
 
Add database platform
 
| headers="r9c1-t5 r1c3-t5" align="left" |
 
Database platform repositories
 
|- align="left" valign="top"
 
| id="r10c1-t5" headers="r1c1-t5" align="left" |
 
[[Image:renambtn.gif|Rename button]]<br>
 
| headers="r10c1-t5 r1c2-t5" align="left" |
 
Rename repository
 
| headers="r10c1-t5 r1c3-t5" align="left" |
 
Database platform repositories
 
|- align="left" valign="top"
 
| id="r11c1-t5" headers="r1c1-t5" align="left" |
 
[[Image:ddbrbtn.gif|Delete platform button]]<br>
 
| headers="r11c1-t5 r1c2-t5" align="left" |
 
Delete platform
 
| headers="r11c1-t5 r1c3-t5" align="left" |
 
Database platform repositories
 
|- align="left" valign="top"
 
| id="r12c1-t5" headers="r1c1-t5" align="left" |
 
[[Image:cdbrbtn.gif|Clone platform button]]<br>
 
| headers="r12c1-t5 r1c2-t5" align="left" |
 
Clone platform
 
| headers="r12c1-t5 r1c3-t5" align="left" |
 
Database platform repositories
 
|- align="left" valign="top"
 
| id="r13c1-t5" headers="r1c1-t5" align="left" |
 
[[Image:tdbrbtn.gif|Add database type button]]<br>
 
| headers="r13c1-t5 r1c2-t5" align="left" |
 
Add database type
 
| headers="r13c1-t5 r1c3-t5" align="left" |
 
Database platform repositories
 
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r14c1-t5" headers="r1c1-t5" align="left" |
 
| id="r14c1-t5" headers="r1c1-t5" align="left" |
Line 551: Line 505:
 
Database sessions, session brokers
 
Database sessions, session brokers
 
|}
 
|}
 
 
  
 
===How to Use the Navigator===
 
===How to Use the Navigator===
Line 607: Line 559:
  
 
[[EclipseLink Workbench Error Reference (ELUG)]] contains more information on each Workbench error message.
 
[[EclipseLink Workbench Error Reference (ELUG)]] contains more information on each Workbench error message.
 
 
  
  
Line 623: Line 573:
 
# Selected element (from the '''Navigator''')
 
# Selected element (from the '''Navigator''')
 
# Editor property tabs
 
# Editor property tabs
 
  
  
Line 640: Line 589:
  
 
You can also [[Creating%20a%20Project%20(ELUG)#How to Generate the Project Status Report|create a status report]] that includes all errors in a selected project.
 
You can also [[Creating%20a%20Project%20(ELUG)#How to Generate the Project Status Report|create a status report]] that includes all errors in a selected project.
 
 
  
 
==Using Workbench Preferences==
 
==Using Workbench Preferences==
Line 653: Line 600:
 
Workbench provides the following preferences:
 
Workbench provides the following preferences:
 
* [[#How to Use General Preferences|General Preferences]]
 
* [[#How to Use General Preferences|General Preferences]]
 +
** [[#How to Use Help Preferences|Help Preferences]]
 
* [[#How to Use Mappings Preferences|Mappings Preferences]]
 
* [[#How to Use Mappings Preferences|Mappings Preferences]]
 
** [[#How to Use Class Preferences|Class Preferences]]
 
** [[#How to Use Class Preferences|Class Preferences]]
Line 666: Line 614:
  
 
To export your preferences, click '''Export''' and select a directory location and filename.
 
To export your preferences, click '''Export''' and select a directory location and filename.
 
  
  
Line 714: Line 661:
  
  
 +
===How to Use Help Preferences===
 +
The EclipseLink Workbench online help is web-based. Use the Help preferences to define the location of your web browser.
 +
 +
Follow these steps to customize the Help preferences:
 +
# Select '''Tools > Preferences''' from the menu. The '''Preferences''' dialog box appears.
 +
# Select '''General > Help''' in the '''Category''' window. The '''Help''' dialog box appears.<br>'''''Preferences – Help Dialog Box'''''<br>[[Image:pref_help.gif|Preferences – Help Dialog Box]]<br><br>
 +
# Click '''Browse''' and select your HTML web browser.
 +
# Click '''OK'''.
 +
 +
'''Note''': If your location requires a proxy to browse external web pages, be sure to complete the '''Proxy''' fields on the [[#How to Use General Preferences|General Preferences]] page.
  
 
===How to Use Mappings Preferences===
 
===How to Use Mappings Preferences===
Line 735: Line 692:
 
| headers="r3c1-t7 r1c2-t7" align="left" | Configure whether or not Workbench always allows, never allows, or prompts before allowing you to change the configuration of a query associated with a descriptor.
 
| headers="r3c1-t7 r1c2-t7" align="left" | Configure whether or not Workbench always allows, never allows, or prompts before allowing you to change the configuration of a query associated with a descriptor.
 
|}
 
|}
 
 
 
  
  
Line 745: Line 699:
 
# Expand '''Mappings''' in the '''Category''' window and select '''Class'''.<br><span id="Figure 4-11"></span>'''''Preferences  –  Mappings  –  Class Dialog Box'''''<br>[[Image:pref_map_class.gif|Preferences  –  Mappings  –  Class Dialog Box]]<br><br>
 
# Expand '''Mappings''' in the '''Category''' window and select '''Class'''.<br><span id="Figure 4-11"></span>'''''Preferences  –  Mappings  –  Class Dialog Box'''''<br>[[Image:pref_map_class.gif|Preferences  –  Mappings  –  Class Dialog Box]]<br><br>
 
# On the '''Preferences''' – '''Mappings''' – '''Class''' dialog box, specify how Workbench maintains classes when renaming or editing a zero-argument constructor.
 
# On the '''Preferences''' – '''Mappings''' – '''Class''' dialog box, specify how Workbench maintains classes when renaming or editing a zero-argument constructor.
 
 
  
  
Line 770: Line 722:
 
| headers="r3c1-t8 r1c2-t8" align="left" | Enter the custom database connection URL.
 
| headers="r3c1-t8 r1c2-t8" align="left" | Enter the custom database connection URL.
 
|}
 
|}
 
 
  
  
Line 784: Line 734:
  
 
To change the order in which EclipseLink searches these JAR or ZIP files, select a file and click '''Up''' to move it up, or click '''Down''' to move it down in the list.
 
To change the order in which EclipseLink searches these JAR or ZIP files, select a file and click '''Up''' to move it up, or click '''Down''' to move it down in the list.
 
  
  
Line 816: Line 765:
 
Specify the default name for newly created connection pools (default, <tt>ConnectionPool</tt>). See [[Creating%20an%20Internal%20Connection%20Pool%20(ELUG)#Creating an Internal Connection Pool|Creating an Internal Connection Pool]] for more information.
 
Specify the default name for newly created connection pools (default, <tt>ConnectionPool</tt>). See [[Creating%20an%20Internal%20Connection%20Pool%20(ELUG)#Creating an Internal Connection Pool|Creating an Internal Connection Pool]] for more information.
 
|}
 
|}
 
 
  
  
Line 841: Line 788:
 
Select the default data source type ('''Database''', '''EIS''', or '''XML''') and platform for newly created sessions. See [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]] for more information.
 
Select the default data source type ('''Database''', '''EIS''', or '''XML''') and platform for newly created sessions. See [[Configuring%20a%20Session%20(ELUG)#Configuring the Server Platform|Configuring the Server Platform]] for more information.
 
|}
 
|}
 
 
 
 
===How to Use Platforms Preferences===
 
Use the Platforms preferences to specify if platforms are to be visible in production. Follow these steps to set Platforms preferences:
 
# Select '''Tools > Preferences''' from the menu. The '''Preferences''' dialog box appears.
 
# Select '''Platforms''' in the '''Category''' window.<br><span id="Figure 4-16"></span>''''' Preferences  –  Platforms Preferences'''''<br>[[Image:pref_plat.gif|Preferences  –  Platforms Preferences]]<br><br>
 
# Configure whether or not Workbench allows platforms to be visible in production.
 
  
 
==Using Databases==
 
==Using Databases==
Line 872: Line 810:
 
* [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]]
 
* [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]]
 
* [[#How to Generate Data from Database Tables|How to Generate Data from Database Tables]]
 
* [[#How to Generate Data from Database Tables|How to Generate Data from Database Tables]]
 
  
  
Line 885: Line 822:
  
 
See [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]] for more information.
 
See [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]] for more information.
 
  
  
Line 893: Line 829:
 
# To log in to a relational database, right-click the database object in the '''Navigator''', and choose '''Log In to Database''' from the context menu or choose '''Selected''' > '''Log In to Database''' from the menu.
 
# To log in to a relational database, right-click the database object in the '''Navigator''', and choose '''Log In to Database''' from the context menu or choose '''Selected''' > '''Log In to Database''' from the menu.
 
# To log out of a relational database, right-click the database object in the '''Navigator''' and choose '''Log Out of Database''' from the context menu or choose '''Selected''' > '''Log Out of Database''' from the menu.
 
# To log out of a relational database, right-click the database object in the '''Navigator''' and choose '''Log Out of Database''' from the context menu or choose '''Selected''' > '''Log Out of Database''' from the menu.
 
  
  
Line 927: Line 862:
  
 
Continue with [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]] to use these tables in your project.
 
Continue with [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]] to use these tables in your project.
 
  
  
Line 941: Line 875:
  
 
To import tables from the database, use the following procedure:
 
To import tables from the database, use the following procedure:
# Select the database object in the '''Navigator,''' and click '''Add/Update Existing Tables from Database''' [[Image:addtbldb.gif|Add/Update Existing Tables from Database]]. The '''Import Tables from Database''' dialog box appears.<br>You can also right-click on the database object in the '''Navigator''' and choose '''Add/Update Existing Tables from Database''' from the context menu or choose '''Selected''' > '''Add/Update Existing Tables from Database''' from the menu.<br><span id="Figure 4-19"></span>'''''Import Tables from Database Dialog Box'''''<br>[[Image:importdb.gif|Import Tables from Database Dialog Box]]<br><br>The following numbered callouts identify the following user interface components:
+
# Select the database object in the '''Navigator,''' and click '''Add or Update Existing Tables from Database''' [[Image:addtbldb.gif|Add/Update Existing Tables from Database]]. The '''Import Tables from Database''' dialog box appears.<br>You can also right-click on the database object in the '''Navigator''' and choose '''Add or Update Existing Tables from Database''' from the context menu or choose '''Selected''' > '''Add/Update Existing Tables from Database''' from the menu.<br><span id="Figure 4-19"></span>'''''Import Tables from Database Dialog Box'''''<br>[[Image:importdb.gif|Import Tables from Database Dialog Box]]<br><br>The following numbered callouts identify the following user interface components:
 
## Filters
 
## Filters
 
## Database tables that match the filters
 
## Database tables that match the filters
Line 980: Line 914:
  
 
Examine each table's properties to verify that the imported tables contain the correct information. See [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]] for more information.
 
Examine each table's properties to verify that the imported tables contain the correct information. See [[#How to Use Database Tables in the Editor Window|How to Use Database Tables in the Editor Window]] for more information.
 
 
  
 
====Removing Tables====
 
====Removing Tables====
 
To remove a database table from the project, use the following procedure:
 
To remove a database table from the project, use the following procedure:
# Select a database table in the '''Navigator,''' and click '''Remove Table''' [[Image:remtable.gif|Remove Table button]] on the toolbar. Workbench prompts for confirmation.<br>You can also right-click on the database object and choose '''Remove''' from the context menu or choose '''Selected''' > '''Remove Table''' from the menu.
+
# Select a database table in the '''Navigator,''' and click '''Remove Selected Item''' [[Image:remtable.gif|Remove Table button]] on the toolbar. Workbench prompts for confirmation.<br>You can also right-click on the database object and choose '''Remove''' from the context menu or choose '''Selected''' > '''Remove''' from the menu.
 
# Click '''OK'''. Workbench removes the table from the project.<br>
 
# Click '''OK'''. Workbench removes the table from the project.<br>
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
Line 994: Line 926:
 
====Renaming Tables====
 
====Renaming Tables====
 
To rename a database table in the Workbench project, use the following procedure:
 
To rename a database table in the Workbench project, use the following procedure:
# Right-click the table in the '''Navigator''' and choose '''Rename''' from the context menu. The Rename dialog box appears.<br>You can also select the table and choose '''Selected''' > '''Rename''' from the menu.
+
# Select a database table in the '''Navigator,''' and click '''Rename''' on the toolbar. The Rename dialog box appears.<br>You can also right-click on the table and choose '''Rename''' from the context menu or choose '''Selected''' > '''Rename''' from the menu.
 
# Enter a new name and click '''OK'''. Workbench renames the table.<br>
 
# Enter a new name and click '''OK'''. Workbench renames the table.<br>
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
Line 1,000: Line 932:
 
'''Note''': Although you have renamed the table in the Workbench project, the original table name remains in the database.
 
'''Note''': Although you have renamed the table in the Workbench project, the original table name remains in the database.
 
|}<br>
 
|}<br>
 
 
  
 
====Refreshing Tables from the Database====
 
====Refreshing Tables from the Database====
To refresh (that is, reload) the database tables in the Workbench project, use this procedure:
+
To refresh (that is, reload) the database tables in the Workbench project, use the following procedure:
# Select a database table in the '''Navigator''', and click '''Refresh from Database''' [[Image:refclsbt.gif|Refresh from Database button]] on the toolbar.<br>You can also select the table and choose '''Selected''' > '''Refresh from Database''' from the menu, or click '''Refresh'''. Workbench reloads the database table.
+
# Select the database table in the '''Navigator,''' and click '''Refresh from Database''' on the toolbar.<br>You can also right-click on the database table and choose '''Refresh from Database''' from the context menu or choose '''Selected''' > '''Refresh from Database''' from the menu. Workbench reloads the database table.
 
#When refreshing tables from the database, if there are multiple database tables with similar names, the '''Duplicate Tables''' dialog box appears.<br><span id="Figure 4-20"></span><br>''''' Duplicate Table Dialog Box'''''<br>[[Image:duptable.gif|Duplicate Table Dialog Box]]<br><br>
 
#When refreshing tables from the database, if there are multiple database tables with similar names, the '''Duplicate Tables''' dialog box appears.<br><span id="Figure 4-20"></span><br>''''' Duplicate Table Dialog Box'''''<br>[[Image:duptable.gif|Duplicate Table Dialog Box]]<br><br>
 
#Select the specific database table to update, and then click '''OK'''.
 
#Select the specific database table to update, and then click '''OK'''.
Line 1,019: Line 949:
 
* [[#Creating Table References|Creating Table References]]
 
* [[#Creating Table References|Creating Table References]]
 
* [[#Creating Field Associations|Creating Field Associations]]
 
* [[#Creating Field Associations|Creating Field Associations]]
 
  
  
Line 1,075: Line 1,004:
  
 
To rename a field, select the field and click '''Rename'''.
 
To rename a field, select the field and click '''Rename'''.
 
  
  
 
====Setting a Primary Key for Database Tables====
 
====Setting a Primary Key for Database Tables====
 
To set a primary key(s) for a database table, use this procedure:
 
To set a primary key(s) for a database table, use this procedure:
 +
  
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
Line 1,090: Line 1,019:
 
# Click the '''Columns''' tab.Click the '''Columns''' tab.<br>'''''Setting Primary Key for a Database Table<br><span id="Figure 4-22"></span>'''''<br>[[Image:fieldspk.gif|Setting Primary Key for a Database Table]]<br><br>
 
# Click the '''Columns''' tab.Click the '''Columns''' tab.<br>'''''Setting Primary Key for a Database Table<br><span id="Figure 4-22"></span>'''''<br>[[Image:fieldspk.gif|Setting Primary Key for a Database Table]]<br><br>
 
# Select the '''Primary Key''' field(s) for the table.
 
# Select the '''Primary Key''' field(s) for the table.
 
  
  
Line 1,129: Line 1,057:
  
 
Continue with [[#Creating Field Associations|Creating Field Associations]].
 
Continue with [[#Creating Field Associations|Creating Field Associations]].
 
  
  
Line 1,152: Line 1,079:
 
| headers="r2c1-t19 r1c2-t19" align="left" | <br>
 
| headers="r2c1-t19 r1c2-t19" align="left" | <br>
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r3c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''Reference Name'''</blockquote>
+
| id="r3c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''Name'''</blockquote>
 
| headers="r3c1-t19 r1c2-t19" align="left" | Specify the name of this table reference
 
| headers="r3c1-t19 r1c2-t19" align="left" | Specify the name of this table reference
 
|- align="left" valign="top"
 
|- align="left" valign="top"
Line 1,158: Line 1,085:
 
| headers="r4c1-t19 r1c2-t19" align="left" | Specify the database table that is the ''target'' of this reference.
 
| headers="r4c1-t19 r1c2-t19" align="left" | Specify the database table that is the ''target'' of this reference.
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r5c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''On Table'''</blockquote>
+
| id="r5c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''On Database'''</blockquote>
 
| headers="r5c1-t19 r1c2-t19" align="left" | Specify if the reference exists on the database.
 
| headers="r5c1-t19 r1c2-t19" align="left" | Specify if the reference exists on the database.
 
|- align="left" valign="top"
 
|- align="left" valign="top"
Line 1,164: Line 1,091:
 
| headers="r6c1-t19 r1c2-t19" align="left" | <br>
 
| headers="r6c1-t19 r1c2-t19" align="left" | <br>
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r7c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''Source Field'''</blockquote>
+
| id="r7c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''Source Column'''</blockquote>
 
| headers="r7c1-t19 r1c2-t19" align="left" | Select the database field from the source table.
 
| headers="r7c1-t19 r1c2-t19" align="left" | Select the database field from the source table.
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r8c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''Target Field'''</blockquote>
+
| id="r8c1-t19" headers="r1c1-t19" align="left" | <blockquote>'''Target Column'''</blockquote>
 
| headers="r8c1-t19 r1c2-t19" align="left" | Select the database field from the target table.
 
| headers="r8c1-t19 r1c2-t19" align="left" | Select the database field from the target table.
 
|}
 
|}
Line 1,177: Line 1,104:
 
* [[#Generating Classes and Descriptors from Database Tables|Generating Classes and Descriptors from Database Tables]]
 
* [[#Generating Classes and Descriptors from Database Tables|Generating Classes and Descriptors from Database Tables]]
 
* [[#Generating Tables on the Database|Generating Tables on the Database]]
 
* [[#Generating Tables on the Database|Generating Tables on the Database]]
 
  
  
Line 1,185: Line 1,111:
 
To automatically generate SQL scripts to create the tables in a project, use this procedure:
 
To automatically generate SQL scripts to create the tables in a project, use this procedure:
 
# Select the database table(s) in the '''Navigator'''.
 
# Select the database table(s) in the '''Navigator'''.
# Right-click the table(s) and choose '''Generate Creation Script for''' > '''Selected Table''' or '''All Tables''' from the context menu. The SQL Creation Script dialog box appears.<br>You can also choose '''Selected''' > '''Generate Creation Script for''' > '''Selected Table''' or '''All Tables''' from the menu.<br><span id="Figure 4-26"></span>''''' SQL Creation Script Dialog Box'''''<br>[[Image:sqlscrip.gif|Creation Script Dialog Box]]<br><br>
+
# Right-click the table(s) and choose '''Generate Creation Script for''' > '''Selected Tables''' or '''All Tables''' from the context menu. The SQL Creation Script dialog box appears.<br>You can also choose '''Selected''' > '''Generate Creation Script for''' > '''Selected Tables''' or '''All Tables''' from the menu.<br><span id="Figure 4-26"></span>''''' SQL Creation Script Dialog Box'''''<br>[[Image:sqlscrip.gif|Creation Script Dialog Box]]<br><br>
  
 
Copy the script and paste it into a file. You may need to edit the file to include additional SQL information that Workbench could not generate. If the database table or column name is an SQL reserved word, you must edit the SQL script and enclose the database table or column in quotes.
 
Copy the script and paste it into a file. You may need to edit the file to include additional SQL information that Workbench could not generate. If the database table or column name is an SQL reserved word, you must edit the SQL script and enclose the database table or column in quotes.
  
<br>
 
  
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
Line 1,195: Line 1,120:
 
'''Note''': If EclipseLink cannot determine how a particular table feature should be implemented in SQL, it generates a descriptive message in the script.
 
'''Note''': If EclipseLink cannot determine how a particular table feature should be implemented in SQL, it generates a descriptive message in the script.
 
|}
 
|}
 
 
 
  
 
====Generating Classes and Descriptors from Database Tables====
 
====Generating Classes and Descriptors from Database Tables====
Line 1,216: Line 1,138:
 
<ol>
 
<ol>
 
<li> Select the database table(s) in the '''Navigator'''.</li>
 
<li> Select the database table(s) in the '''Navigator'''.</li>
<li> Right-click the table(s) and choose '''Generate Classes and Descriptors from''' > '''Selected Table''' or '''All Tables''' from the context menu.<br>You can also choose '''Selected''' > '''Generate Classes and Descriptors from''' > '''Selected Table''' or '''All Tables''' from the menu.</li>
+
<li> Right-click the table(s) and choose '''Generate Classes and Descriptors from''' > '''Selected Tables''' or '''All Tables''' from the context menu. Workbench prompts you to save your project. <br>You can also choose '''Selected''' > '''Generate Classes and Descriptors from''' > '''Selected Tables''' or '''All Tables''' from the menu. </li>
 
<li> Click '''Yes'''. The Generate Classes and Descriptors dialog box appears.<br><span id=
 
<li> Click '''Yes'''. The Generate Classes and Descriptors dialog box appears.<br><span id=
 
Figure 4-27"></span>'''''Generate Classes and Descriptors Dialog Box'''''<br>[[Image:generateclasses.gif|Generate Classes and Descriptors Dialog Box]]<br><br>Complete each field on the Generate Classes and Descriptors dialog box and click '''OK'''. Use the following information to enter data in each field:
 
Figure 4-27"></span>'''''Generate Classes and Descriptors Dialog Box'''''<br>[[Image:generateclasses.gif|Generate Classes and Descriptors Dialog Box]]<br><br>Complete each field on the Generate Classes and Descriptors dialog box and click '''OK'''. Use the following information to enter data in each field:
Line 1,245: Line 1,167:
 
</ol>
 
</ol>
 
The newly created descriptors appear in the '''Navigator''' of Workbench.
 
The newly created descriptors appear in the '''Navigator''' of Workbench.
 
 
  
 
====Generating Tables on the Database====
 
====Generating Tables on the Database====
Line 1,257: Line 1,177:
 
|}
 
|}
  
<br>
 
  
 
# Select the database table(s) in the '''Navigator'''.
 
# Select the database table(s) in the '''Navigator'''.
# Right-click the table(s) and choose '''Create on Database''' > '''Selected Table''' or '''All Tables''' from the context menu.<br>You can also create tables by selecting '''Selected''' > '''Create on Database''' > '''Selected Table''' or '''All Tables''' from the menu.
+
# Right-click the table(s) and choose '''Create on Database''' > '''Selected Tables''' or '''All Tables''' from the context menu.<br>You can also create tables by selecting '''Selected''' > '''Create on Database''' > '''Selected Tables''' or '''All Tables''' from the menu.
  
 
Workbench creates the tables on the database.
 
Workbench creates the tables on the database.
  
 
Alternatively, you can generate tables at run time by exporting the information in Workbench to a <tt>TableCreator</tt> class (see [[Using%20the%20Schema%20Manager%20(ELUG)#Introduction to the Schema Manager|Introduction to the Schema Manager]]).
 
Alternatively, you can generate tables at run time by exporting the information in Workbench to a <tt>TableCreator</tt> class (see [[Using%20the%20Schema%20Manager%20(ELUG)#Introduction to the Schema Manager|Introduction to the Schema Manager]]).
 
 
  
 
==Using XML Schemas==
 
==Using XML Schemas==
Line 1,277: Line 1,194:
 
* [[#How to Configure an XML Schema Reference|How to Configure an XML Schema Reference]]
 
* [[#How to Configure an XML Schema Reference|How to Configure an XML Schema Reference]]
 
* [[#How to Configure XML Schema Namespace|How to Configure XML Schema Namespace]]
 
* [[#How to Configure XML Schema Namespace|How to Configure XML Schema Namespace]]
 
  
  
Line 1,297: Line 1,213:
 
* [[#How to Configure an XML Schema Reference|How to Configure an XML Schema Reference]]
 
* [[#How to Configure an XML Schema Reference|How to Configure an XML Schema Reference]]
 
* [[#How to Configure XML Schema Namespace|How to Configure XML Schema Namespace]]
 
* [[#How to Configure XML Schema Namespace|How to Configure XML Schema Namespace]]
 
  
  
Line 1,328: Line 1,243:
  
 
These fields are for display only and cannot be changed in Workbench.
 
These fields are for display only and cannot be changed in Workbench.
 
  
  
Line 1,384: Line 1,298:
  
 
To change a schema's source, right-click on the specific schema in the Navigator window and select '''Properties''' from the context menu. The Schema Properties dialog appears.
 
To change a schema's source, right-click on the specific schema in the Navigator window and select '''Properties''' from the context menu. The Schema Properties dialog appears.
 +
  
 
===How to Configure an XML Schema Reference===
 
===How to Configure an XML Schema Reference===
 
After you import an XML schema (see [[#How to Import an XML Schema|How to Import an XML Schema]]), you can update its source by configuring the schema reference.
 
After you import an XML schema (see [[#How to Import an XML Schema|How to Import an XML Schema]]), you can update its source by configuring the schema reference.
 
  
  
Line 1,431: Line 1,345:
 
Enter the fully qualified name of the XML schema file including the name of the package of which it is a part. For example, if your XML schema mySchema.xsd is in <tt>C:\project\config</tt> and you add this directory to your project classpath (see [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configuring Project Classpath]], specify a resource name of <tt>project.config.mySchema.xsd</tt>.
 
Enter the fully qualified name of the XML schema file including the name of the package of which it is a part. For example, if your XML schema mySchema.xsd is in <tt>C:\project\config</tt> and you add this directory to your project classpath (see [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configuring Project Classpath]], specify a resource name of <tt>project.config.mySchema.xsd</tt>.
 
|}
 
|}
 +
  
 
====How to Configure an XML Schema Reference Using Java====
 
====How to Configure an XML Schema Reference Using Java====
Line 1,436: Line 1,351:
 
* If you are using <tt>EISDescriptors</tt>, the EclipseLink runtime does not use the schema reference; no further configuration is required.
 
* If you are using <tt>EISDescriptors</tt>, the EclipseLink runtime does not use the schema reference; no further configuration is required.
 
* If you are using <tt>XMLDescriptors</tt>, configure the descriptor with the <tt>XMLSchemaReference</tt> using <tt>XMLDescriptor</tt> method <tt>setSchemaReference</tt>.
 
* If you are using <tt>XMLDescriptors</tt>, configure the descriptor with the <tt>XMLSchemaReference</tt> using <tt>XMLDescriptor</tt> method <tt>setSchemaReference</tt>.
 
  
  
Line 1,503: Line 1,417:
  
 
For more information, see [[Introduction%20to%20Projects (ELUG)#XML Namespaces Overview|XML Namespaces Overview]].
 
For more information, see [[Introduction%20to%20Projects (ELUG)#XML Namespaces Overview|XML Namespaces Overview]].
 
  
  
Line 1,544: Line 1,457:
 
When selected, XML documents must use the corresponding URI qualifier when referring to types from this namespace. XML documents may use a different prefix value as long as that value is associated with the appropriate namespace URI. For more information, see [[Introduction%20to%20Projects (ELUG)#EclipseLink Runtime Namespace Resolution|EclipseLink Runtime Namespace Resolution]].
 
When selected, XML documents must use the corresponding URI qualifier when referring to types from this namespace. XML documents may use a different prefix value as long as that value is associated with the appropriate namespace URI. For more information, see [[Introduction%20to%20Projects (ELUG)#EclipseLink Runtime Namespace Resolution|EclipseLink Runtime Namespace Resolution]].
 
|}
 
|}
 +
  
 
====How to Configure XML Schema Namespace Using Java====
 
====How to Configure XML Schema Namespace Using Java====
Line 1,567: Line 1,481:
 
* [[#How to Manage Nondescriptor Classes|How to Manage Nondescriptor Classes]]
 
* [[#How to Manage Nondescriptor Classes|How to Manage Nondescriptor Classes]]
 
* [[#How to Rename Packages|How to Rename Packages]]
 
* [[#How to Rename Packages|How to Rename Packages]]
 
  
  
Line 1,578: Line 1,491:
  
 
For more information on using Workbench to edit classes, see [[#How to Create Classes|How to Create Classes]].
 
For more information on using Workbench to edit classes, see [[#How to Create Classes|How to Create Classes]].
 
  
  
Line 1,584: Line 1,496:
 
To create new classes and packages from within Workbench, use this procedure:
 
To create new classes and packages from within Workbench, use this procedure:
  
# Select the project in the '''Navigator''' and click '''Create New Class''' [[Image:creatcls.gif|Create New Class button]].<br>You can also right-click the project in the '''Navigator''' and choose '''Create New Class''' from the context menu or choose '''Selected''' > '''Create New Class''' from the menu.<br><span id="Figure 4-35"></span>''''' Add New Class Dialog Box'''''<br>[[Image:addclass.gif|Add New Class Dialog Box]]<br><br>
+
# Select the project in the '''Navigator''' and click '''Create New Class''' [[Image:creatcls.gif|Create New Class button]].<br>You can also right-click the project in the '''Navigator''' and choose '''Create New Class''' from the context menu or choose '''Selected''' > '''Create New Class''' from the menu.<br><span id="Figure 4-35"></span>''''' Add Class Dialog Box'''''<br>[[Image:addclass.gif|Add Class Dialog Box]]<br><br>
# Enter data in each field on the Add New Class dialog box and click '''OK'''. Workbench will add the new class to the project in the '''Navigator'''.
+
# Enter data in each field on the Add Class dialog box and click '''OK'''. Workbench will add the new class to the project in the '''Navigator'''.
  
Use the following information to enter data in each field on the Add New Class dialog box:
+
Use the following information to enter data in each field on the Add Class dialog box:
{| class="HRuleInformal" dir="ltr" title="This table describes each field on the Add New Class dialog." summary="This table describes each field on the Add New Class dialog." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
{| class="HRuleInformal" dir="ltr" title="This table describes each field on the Add Class dialog." summary="This table describes each field on the Add Class dialog." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
! id="r1c1-t29" align="left" valign="bottom" | '''Field'''
 
! id="r1c1-t29" align="left" valign="bottom" | '''Field'''
Line 1,614: Line 1,526:
 
* [[#Adding Attributes|Adding Attributes]]
 
* [[#Adding Attributes|Adding Attributes]]
 
* [[#Configuring Attribute Modifiers|Configuring Attribute Modifiers]]
 
* [[#Configuring Attribute Modifiers|Configuring Attribute Modifiers]]
* [[#Configuring Attribute Type Information|Configuring Attribute Type Information]]
+
* [[#Configuring Attribute Type Declaration|Configuring Attribute Type Declaration]]
 
* [[#Configuring Attribute Accessing Methods|Configuring Attribute Accessing Methods]]
 
* [[#Configuring Attribute Accessing Methods|Configuring Attribute Accessing Methods]]
 
* [[#Adding Methods|Adding Methods]]
 
* [[#Adding Methods|Adding Methods]]
 
* [[#Configuring Method Modifiers|Configuring Method Modifiers]]
 
* [[#Configuring Method Modifiers|Configuring Method Modifiers]]
* [[#Configuring Method Type Information|Configuring Method Type Information]]
+
* [[#Configuring Method Return Type|Configuring Method Return Type]]
 
* [[#Configuring Method Parameters|Configuring Method Parameters]]
 
* [[#Configuring Method Parameters|Configuring Method Parameters]]
 
  
  
 
====Configuring Class Information====
 
====Configuring Class Information====
 
This section includes information on using the workbench to configure class information.
 
This section includes information on using the workbench to configure class information.
 
  
  
Line 1,649: Line 1,559:
 
| headers="r3c1-t30 r1c2-t30" align="left" | Click '''Browse''' and select a class and package that contains the class (that is, the superclass).
 
| headers="r3c1-t30 r1c2-t30" align="left" | Click '''Browse''' and select a class and package that contains the class (that is, the superclass).
 
|}
 
|}
 
 
  
  
 
====Configuring Class Modifiers====
 
====Configuring Class Modifiers====
 
This section includes information on using the workbench to configure class modifiers.
 
This section includes information on using the workbench to configure class modifiers.
 
  
  
Line 1,680: Line 1,587:
 
| headers="r3c1-t31 r1c2-t31" align="left" | Specify if the class is '''Final''' or '''Abstract''', or both. Final classes are not included in the superclass selection lists for other classes to extend.
 
| headers="r3c1-t31 r1c2-t31" align="left" | Specify if the class is '''Final''' or '''Abstract''', or both. Final classes are not included in the superclass selection lists for other classes to extend.
 
|}
 
|}
 
  
  
Line 1,687: Line 1,593:
  
 
Although you may add interfaces to a project directly (see [[#How to Import and Update Classes|How to Import and Update Classes]]), you do not need to do so in order to configure a class to implement an interface.
 
Although you may add interfaces to a project directly (see [[#How to Import and Update Classes|How to Import and Update Classes]]), you do not need to do so in order to configure a class to implement an interface.
 
  
  
Line 1,707: Line 1,612:
 
| id="r2c1-t32" headers="r1c1-t32" align="left" | '''Interfaces Implemented'''
 
| id="r2c1-t32" headers="r1c1-t32" align="left" | '''Interfaces Implemented'''
 
| headers="r2c1-t32 r1c2-t32" align="left" |
 
| headers="r2c1-t32 r1c2-t32" align="left" |
To add an interface, click '''Add''' and select the interface and package. To remove an interface, select the interface and click '''Remove'''
+
To add an interface, click '''Add'''. The Choose Class dialog box appears. In the dialog box, select the interface and package. To remove an interface, select the interface and click '''Remove'''.
 
|}
 
|}
 
 
 
  
 
====Adding Attributes====
 
====Adding Attributes====
 
This section includes information on using the workbench to add an attribute to a class.
 
This section includes information on using the workbench to add an attribute to a class.
 
  
  
Line 1,721: Line 1,622:
 
* To add a new attribute (field) to the descriptor, click '''Add.'''
 
* To add a new attribute (field) to the descriptor, click '''Add.'''
 
* To delete an existing attribute, select the attribute and click '''Remove'''.
 
* To delete an existing attribute, select the attribute and click '''Remove'''.
* To rename an existing attribute, select the attribute and click on '''Rename'''.
+
* To rename an existing attribute, select the attribute and click '''Rename'''.
  
 
The '''Attributes''' tab contains the following tabs:
 
The '''Attributes''' tab contains the following tabs:
 
* General
 
* General
 
* Accessors
 
* Accessors
 
 
  
 
====Configuring Attribute Modifiers====
 
====Configuring Attribute Modifiers====
 
This section includes information on using the workbench to configure attribute modifiers.
 
This section includes information on using the workbench to configure attribute modifiers.
 
  
  
Line 1,764: Line 1,662:
 
|}
 
|}
  
====Configuring Attribute Type Information====
 
This section includes information on using the workbench to configure attribute type information.
 
  
 +
====Configuring Attribute Type Declaration====
 +
This section includes information on using the workbench to configure attribute type declaration.
  
  
 
=====Using Workbench=====
 
=====Using Workbench=====
To specify attribute type information, use this procedure:
+
To specify attribute type declaration, use this procedure:
 
# Select a class in the '''Navigator'''. Its properties appear in the '''Editor'''.
 
# Select a class in the '''Navigator'''. Its properties appear in the '''Editor'''.
 
# Click the '''Class Info''' tab in the '''Editor'''.
 
# Click the '''Class Info''' tab in the '''Editor'''.
 
# Click the '''Attributes''' tab. The Attributes tab contains two sub-tabs.
 
# Click the '''Attributes''' tab. The Attributes tab contains two sub-tabs.
# Click the '''General''' tab.<br><span id="Figure 4-40"></span>''''' Attributes Tab, Type Information Fields'''''<br>[[Image:clatgentyp.gif|Attributes Tab, Type Information Fields]]<br><br>
+
# Click the '''General''' tab.<br><span id="Figure 4-40"></span>''''' Attributes Tab, Type Declaration Fields'''''<br>[[Image:clatgentyp.gif|Attributes Tab, Type Declaration Fields]]<br><br>
# Complete the Type Information fields on the Attributes tab.
+
# Complete the Type Declaration fields on the Attributes tab.
  
  
Use the following information to enter data in Type Information fields on the Attributes tab:
+
Use the following information to enter data in Type Declaration fields on the Attributes tab:
{| class="HRuleInformal" dir="ltr" title="This table identifies Type Information fields on the Attributes tab" summary="This table identifies Type Information fields on the Attributes tab" width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
{| class="HRuleInformal" dir="ltr" title="This table identifies Type Declaration fields on the Attributes tab" summary="This table identifies Type Declaration fields on the Attributes tab" width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
! id="r1c1-t34" align="left" valign="bottom" | '''Field'''
 
! id="r1c1-t34" align="left" valign="bottom" | '''Field'''
Line 1,787: Line 1,685:
 
| headers="r2c1-t34 r1c2-t34" align="left" | Click '''Browse''' and select a class and package for the attribute.
 
| headers="r2c1-t34 r1c2-t34" align="left" | Click '''Browse''' and select a class and package for the attribute.
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r3c1-t34" headers="r1c1-t34" align="left" | '''Type Dimensionality'''
+
| id="r3c1-t34" headers="r1c1-t34" align="left" | '''Dimensionality'''
 
| headers="r3c1-t34 r1c2-t34" align="left" | Specify the length of an array. This field applies only if '''Type''' is an array.
 
| headers="r3c1-t34 r1c2-t34" align="left" | Specify the length of an array. This field applies only if '''Type''' is an array.
 
|- align="left" valign="top"
 
|- align="left" valign="top"
Line 1,806: Line 1,704:
 
Click '''Browse''' and select a class and package for the attribute. This field applies for <tt>List</tt> types only.
 
Click '''Browse''' and select a class and package for the attribute. This field applies for <tt>List</tt> types only.
 
|}
 
|}
 
 
 
  
 
====Configuring Attribute Accessing Methods====
 
====Configuring Attribute Accessing Methods====
 
This section includes information on using the workbench to configure attribute accessing methods. If you change an attribute and regenerate the accessing methods, EclipseLink ''does not'' remove any previously generated methods.
 
This section includes information on using the workbench to configure attribute accessing methods. If you change an attribute and regenerate the accessing methods, EclipseLink ''does not'' remove any previously generated methods.
 
  
  
Line 1,861: Line 1,755:
 
Choose the method used to set the actual value. This field applies for <tt>ValueHolderInterface</tt> types only.
 
Choose the method used to set the actual value. This field applies for <tt>ValueHolderInterface</tt> types only.
 
|}
 
|}
 
 
  
  
 
====Adding Methods====
 
====Adding Methods====
 
This section includes information on the workbench to add a method to a class.
 
This section includes information on the workbench to add a method to a class.
 
  
  
Line 1,881: Line 1,772:
  
 
To rename an existing method, select the method and click '''Rename'''.
 
To rename an existing method, select the method and click '''Rename'''.
 
 
  
  
 
====Configuring Method Modifiers====
 
====Configuring Method Modifiers====
 
This section includes information on using the workbench to configure method modifiers.
 
This section includes information on using the workbench to configure method modifiers.
 
 
  
  
Line 1,920: Line 1,807:
 
|}
 
|}
  
====Configuring Method Type Information====
 
This section includes information on using the workbench to configure method type information.
 
  
 +
====Configuring Method Return Type====
 +
This section includes information on using the workbench to configure method return type.
  
  
 
=====Using Workbench=====
 
=====Using Workbench=====
To specify method type information, use this procedure:
+
To specify method return type, use this procedure:
  
 
# Select a class in the '''Navigator'''. Its properties appear in the '''Editor'''.
 
# Select a class in the '''Navigator'''. Its properties appear in the '''Editor'''.
 
# Click the '''Class Info''' tab in the '''Editor'''.
 
# Click the '''Class Info''' tab in the '''Editor'''.
# Click the '''Methods''' tab.<br><span id="Figure 4-44"></span>''''' Methods Tab, Type Information Fields'''''<br>[[Image:clmetyp.gif|Methods Tab, Type Information Fields]]<br><br>
+
# Click the '''Methods''' tab.<br><span id="Figure 4-44"></span>''''' Methods Tab, Return Type Fields'''''<br>[[Image:clmetyp.gif|Methods Tab, Return Type Fields]]<br><br>
# Complete the Type Information fields on the Methods tab.
+
# Complete the Return Type fields on the Methods tab.
  
  
Use the following information to enter data in Type Information fields on the Methods tab:
+
Use the following information to enter data in Return Type fields on the Methods tab:
{| class="HRuleInformal" dir="ltr" title="This table identifies Type Information fields on the Methods tab." summary="This table identifies Type Information fields on the Methods tab." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
{| class="HRuleInformal" dir="ltr" title="This table identifies Return Type fields on the Methods tab." summary="This table identifies Return Type fields on the Methods tab." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
! id="r1c1-t37" align="left" valign="bottom" | '''Field'''
 
! id="r1c1-t37" align="left" valign="bottom" | '''Field'''
 
! id="r1c2-t37" align="left" valign="bottom" | '''Description'''
 
! id="r1c2-t37" align="left" valign="bottom" | '''Description'''
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r2c1-t37" headers="r1c1-t37" align="left" |'''Return Type'''
+
| id="r2c1-t37" headers="r1c1-t37" align="left" |'''Type'''
 
| headers="r2c1-t37 r1c2-t37" align="left" | Click '''Browse''' and select a class and package for the method.
 
| headers="r2c1-t37 r1c2-t37" align="left" | Click '''Browse''' and select a class and package for the method.
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r3c1-t37" headers="r1c1-t37" align="left" |'''Type Dimensionality'''
+
| id="r3c1-t37" headers="r1c1-t37" align="left" |'''Dimensionality'''
 
| headers="r3c1-t37 r1c2-t37" align="left" | Specify the length of an array. This field applies only if '''Type''' is an array.
 
| headers="r3c1-t37 r1c2-t37" align="left" | Specify the length of an array. This field applies only if '''Type''' is an array.
 
|}
 
|}
Line 1,949: Line 1,836:
 
====Configuring Method Parameters====
 
====Configuring Method Parameters====
 
This section includes information on using the workbench to configure method parameters.
 
This section includes information on using the workbench to configure method parameters.
 
  
  
Line 1,973: Line 1,859:
 
| headers="r3c1-t38 r1c2-t38" align="left" | Specify the length of an array. This field applies only if '''Type''' is an array.
 
| headers="r3c1-t38 r1c2-t38" align="left" | Specify the length of an array. This field applies only if '''Type''' is an array.
 
|}
 
|}
 
 
 
  
 
===How to Import and Update Classes===
 
===How to Import and Update Classes===
Line 1,994: Line 1,877:
  
 
For more information, see [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configuring Project Classpath]].
 
For more information, see [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configuring Project Classpath]].
 
  
  
Line 2,022: Line 1,904:
  
 
Select the descriptor and click '''Remove''' [[Image:remclass.gif|Remove Class button]], or choose '''Selected''' > '''Remove''' from the menu.
 
Select the descriptor and click '''Remove''' [[Image:remclass.gif|Remove Class button]], or choose '''Selected''' > '''Remove''' from the menu.
 +
  
 
===How to Manage Nondescriptor Classes===
 
===How to Manage Nondescriptor Classes===
Line 2,039: Line 1,922:
  
 
Select one of the following options:
 
Select one of the following options:
* To add new classes, click '''Add'''. The Select Classes dialog box appears.
 
 
* To add new classes, click '''Add'''. The Select Classes dialog box appears (see [[#Figure_4-46|the Select Classes Dialog Box]]).<br>Only classes that have been added to the [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|project's classpath]] can be added as nondescriptor classes.  
 
* To add new classes, click '''Add'''. The Select Classes dialog box appears (see [[#Figure_4-46|the Select Classes Dialog Box]]).<br>Only classes that have been added to the [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|project's classpath]] can be added as nondescriptor classes.  
 
* To delete an existing class, select the class and click '''Remove'''.
 
* To delete an existing class, select the class and click '''Remove'''.
Line 2,059: Line 1,941:
  
 
For more information on using Workbench to edit classes, see [[#How to Configure Classes|How to Configure Classes]].
 
For more information on using Workbench to edit classes, see [[#How to Configure Classes|How to Configure Classes]].
 
  
  
Line 2,070: Line 1,951:
  
 
For more information on using Workbench to edit classes, see [[#How to Configure Classes|How to Configure Classes]].
 
For more information on using Workbench to edit classes, see [[#How to Configure Classes|How to Configure Classes]].
 +
  
 
==Integrating Workbench with Apache Ant==
 
==Integrating Workbench with Apache Ant==
Line 2,080: Line 1,962:
  
 
For more information about Ant, see <tt>http://ant.apache.org/manual/</tt>.
 
For more information about Ant, see <tt>http://ant.apache.org/manual/</tt>.
 
  
  
Line 2,087: Line 1,968:
  
 
To declare Workbench tasks in your Ant <tt>build.xml</tt> file, declare them directly (see [[#Declaring Workbench Tasks|Declaring Workbench Tasks]]).
 
To declare Workbench tasks in your Ant <tt>build.xml</tt> file, declare them directly (see [[#Declaring Workbench Tasks|Declaring Workbench Tasks]]).
 
  
  
Line 2,108: Line 1,988:
 
Workbench Ant task and type definitions.
 
Workbench Ant task and type definitions.
 
| headers="r2c1-t41 r1c3-t41" align="left" |
 
| headers="r2c1-t41 r1c3-t41" align="left" |
<tt><</tt>''<tt>ECLIPSELINK_HOME</tt>''<tt>>/lib/java/internal</tt>
+
<tt><</tt>''<tt>ECLIPSELINK_HOME</tt>''<tt>>/utils/workbench/jlib</tt>
 
|}
 
|}
  
Line 2,146: Line 2,026:
 
     ...
 
     ...
 
  </project>
 
  </project>
 +
  
 
===What You May Need to Know About Workbench Ant Task API===
 
===What You May Need to Know About Workbench Ant Task API===
Line 2,201: Line 2,082:
 
<tt>org.eclipse.persistence.tools.workbench.ant.typedefs.LoginSpec</tt>
 
<tt>org.eclipse.persistence.tools.workbench.ant.typedefs.LoginSpec</tt>
 
|}
 
|}
 +
  
 
===How to Create Workbench Ant Tasks===
 
===How to Create Workbench Ant Tasks===
Line 2,221: Line 2,103:
 
   
 
   
 
         <path id = "database.classpath">
 
         <path id = "database.classpath">
             <pathelement path = "${eclipselink.home}/jlib /dms.jar"/>
+
             <pathelement path = "${eclipselink.home}/jlib/dms.jar"/>
             <pathelement path = "${eclipselink.home}/jlib /OracleThinJDBC.jar"/>
+
             <pathelement path = "${eclipselink.home}/jlib/OracleThinJDBC.jar"/>
 
         </path>
 
         </path>
 
         <path id = "eclipselink.classpath">
 
         <path id = "eclipselink.classpath">
             <pathelement path = "${eclipselink.home}/lib/java/api/eclipselink.jar"/>
+
             <pathelement path = "${eclipselink.home}/jlib/eclipselink.jar"/>
+
             <pathelement path = "${eclipselink.home}/lib/shared/11.1.1.0.0/antlr.jar"/>
            <pathelement path = "${oracle.home}/lib/java/api/ejb.jar"/>
+
            <pathelement path = "${oracle.home}/lib /xmlparserv2.jar"/>
+
             <pathelement path =                         "${eclipselink.home}/lib/shared/11.1.1.0.0/antlr.jar"/>
+
 
         </path>
 
         </path>
 
         <path id = "mw.classpath">
 
         <path id = "mw.classpath">
             <pathelement path = "${eclipselink.home}/lib/java/api/tlmwcore.jar"/>
+
             <pathelement path = "${eclipselink.home}/utils/workbench/jlib/elmwcore.jar"/>
 
   
 
   
             <pathelement path = "${eclipselink.home}/lib/java/internal/eclipselinkmw.jar"/>
+
             <pathelement path = "${eclipselink.home}/utils/workbench/jlib/eclipselinkmw.jar"/>
 
         </path>
 
         </path>
 
         <path id = "mwplatforms.classpath">
 
         <path id = "mwplatforms.classpath">
             <pathelement path = "${eclipselink.home}/config"/>
+
             <pathelement path = "${eclipselink.home}/utils/workbench/config"/>
 
         </path>
 
         </path>
 
   
 
   
Line 2,321: Line 2,200:
 
     </target>
 
     </target>
 
  <project>
 
  <project>
 
 
  
 
===How to Create the mappings.validate Task===
 
===How to Create the mappings.validate Task===
Line 2,330: Line 2,207:
 
* log all the problems to a file in text orL format;
 
* log all the problems to a file in text orL format;
 
* set an Ant property to indicate that the Workbench project is valid (has no errors).
 
* set an Ant property to indicate that the Workbench project is valid (has no errors).
 
  
  
Line 2,386: Line 2,262:
 
No
 
No
 
|}
 
|}
 
 
  
  
Line 2,395: Line 2,269:
 
* [[#How to Create the ignoreerror Task|ignoreerror]]
 
* [[#How to Create the ignoreerror Task|ignoreerror]]
 
* [[#How to Create the ignoreerrorset Task|ignorerrorset]]
 
* [[#How to Create the ignoreerrorset Task|ignorerrorset]]
 
  
  
Line 2,418: Line 2,291:
 
   
 
   
 
  </eclipselink:mappings.validate>
 
  </eclipselink:mappings.validate>
 
  
  
Line 2,428: Line 2,300:
 
* specify the test type using a nested element;
 
* specify the test type using a nested element;
 
* set an Ant property to indicate that the Workbench project is valid (has no errors).
 
* set an Ant property to indicate that the Workbench project is valid (has no errors).
 
  
  
Line 2,477: Line 2,348:
 
No
 
No
 
|}
 
|}
 
 
  
  
Line 2,485: Line 2,354:
 
* classpath;
 
* classpath;
 
* [[#How to Create the loginspec Task|loginspec]].
 
* [[#How to Create the loginspec Task|loginspec]].
 
  
  
Line 2,507: Line 2,375:
 
   
 
   
 
  </eclipselink:session.validate>
 
  </eclipselink:session.validate>
 
  
  
Line 2,514: Line 2,381:
  
 
This task provides the ability to override the Workbench project database login information.
 
This task provides the ability to override the Workbench project database login information.
 
  
  
Line 2,577: Line 2,443:
 
No
 
No
 
|}
 
|}
 
 
  
  
Line 2,589: Line 2,453:
 
* [[#How to Create the ignoreerrorTask|ignorerror]];
 
* [[#How to Create the ignoreerrorTask|ignorerror]];
 
* [[#How to Create the ignoreerrorset Task|ignorerrorset]].
 
* [[#How to Create the ignoreerrorset Task|ignorerrorset]].
 
  
  
Line 2,617: Line 2,480:
 
             password="tiger" />
 
             password="tiger" />
 
  </eclipselink:mappings.export>
 
  </eclipselink:mappings.export>
 
  
  
 
===How to Create the classpath Task===
 
===How to Create the classpath Task===
 
Use the classpath element to define the Java classpath necessary to run a task. For more information, see <tt>http://ant.apache.org/manual/usingl#path</tt>.
 
Use the classpath element to define the Java classpath necessary to run a task. For more information, see <tt>http://ant.apache.org/manual/usingl#path</tt>.
 
  
  
Line 2,657: Line 2,518:
 
No
 
No
 
|}
 
|}
 
 
 
  
  
Line 2,668: Line 2,526:
 
* dirset
 
* dirset
 
* filelist
 
* filelist
 
  
  
Line 2,687: Line 2,544:
 
     <filelist refid="third-party_jars"/>
 
     <filelist refid="third-party_jars"/>
 
  </classpath>
 
  </classpath>
 
  
  
Line 2,695: Line 2,551:
  
 
To instruct an EclipseLink Ant task to ignore multiple error codes, consider using an [[#How to Create the ignoreerrorset Task|<tt>ignoreerrorset</tt> element]].
 
To instruct an EclipseLink Ant task to ignore multiple error codes, consider using an [[#How to Create the ignoreerrorset Task|<tt>ignoreerrorset</tt> element]].
 
  
  
Line 2,715: Line 2,570:
 
Yes
 
Yes
 
|}
 
|}
 
 
  
  
 
====Specifying Parameters Specified as Nested Elements====
 
====Specifying Parameters Specified as Nested Elements====
 
You cannot specify parameters as nested elements of this element.
 
You cannot specify parameters as nested elements of this element.
 
  
  
Line 2,736: Line 2,588:
 
     <eclipselink:ignoreerror code = "0545" />
 
     <eclipselink:ignoreerror code = "0545" />
 
  </eclipselink:mappings.export>
 
  </eclipselink:mappings.export>
 
  
  
 
===How to Create the ignoreerrorset Task===
 
===How to Create the ignoreerrorset Task===
 
Use the <tt>ignoreerrorset</tt> element to instruct an EclipseLink Ant task to ignore any of multiple EclipseLink Foundation Library or Workbench run-time error codes.
 
Use the <tt>ignoreerrorset</tt> element to instruct an EclipseLink Ant task to ignore any of multiple EclipseLink Foundation Library or Workbench run-time error codes.
 
  
  
Line 2,768: Line 2,618:
 
No
 
No
 
|}
 
|}
 
 
  
  
Line 2,775: Line 2,623:
 
You can specify the following parameter as nested elements of this element:
 
You can specify the following parameter as nested elements of this element:
 
* [[#How to Create the ignoreerror Task|ignorerror ]]
 
* [[#How to Create the ignoreerror Task|ignorerror ]]
 
  
  
Line 2,785: Line 2,632:
 
  <eclipselink:ignoreerrorset id = "ignoreErrors">
 
  <eclipselink:ignoreerrorset id = "ignoreErrors">
 
     <eclipselink:ignoreerror code = "0402" />
 
     <eclipselink:ignoreerror code = "0402" />
     <eclipselink:ignoreerror code = "0570" /></eclipselink:ignoreerrorset>...<eclipselink:mappings.export
+
     <eclipselink:ignoreerror code = "0570" /></eclipselink:ignoreerrorset>
 +
    ...
 +
    <eclipselink:mappings.export
 
     projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
 
     projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
 
     deploymentfile = "${eclipselink.sessions.dir}/sessions.xml"
 
     deploymentfile = "${eclipselink.sessions.dir}/sessions.xml"
Line 2,794: Line 2,643:
 
     <eclipselink:ignoreerror code = "0545" />
 
     <eclipselink:ignoreerror code = "0545" />
 
  </eclipselink:mappings.export>
 
  </eclipselink:mappings.export>
 
 
  
 
===How to Create the loginspec Task===
 
===How to Create the loginspec Task===
 
Use the <tt>loginspec</tt> element to instruct an EclipseLink Ant task to override the project database login information in a Workbench project. For more information, see [[Introduction%20to%20Data%20Access%20(ELUG)|Introduction to Data Access]].
 
Use the <tt>loginspec</tt> element to instruct an EclipseLink Ant task to override the project database login information in a Workbench project. For more information, see [[Introduction%20to%20Data%20Access%20(ELUG)|Introduction to Data Access]].
 +
  
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
Line 2,840: Line 2,688:
 
url
 
url
 
| headers="r5c1-t51 r1c2-t51" align="left" |
 
| headers="r5c1-t51 r1c2-t51" align="left" |
URL of the driver see [[Configuring%20a%20Database%20Login%20(ELUG)#Configuring Database Login Connection Options|Configuring Database Login Connection Options]]).
+
URL of the driver (see [[Configuring%20a%20Database%20Login%20(ELUG)#Configuring Database Login Connection Options|Configuring Database Login Connection Options]]).
 
| headers="r5c1-t51 r1c3-t51" align="left" |
 
| headers="r5c1-t51 r1c3-t51" align="left" |
 
Yes
 
Yes
Line 2,862: Line 2,710:
 
====Specifying Parameters Specified as Nested Elements====
 
====Specifying Parameters Specified as Nested Elements====
 
You cannot specify parameters as nested elements of this element.
 
You cannot specify parameters as nested elements of this element.
 
  
  
Line 2,893: Line 2,740:
  
 
[[Category: EclipseLink User's Guide]]
 
[[Category: EclipseLink User's Guide]]
[[Category: Draft]]
+
[[Category: Release 1]]
 
[[Category: Concept]]
 
[[Category: Concept]]
 
[[Category: Task]]
 
[[Category: Task]]

Latest revision as of 11:20, 18 July 2012

Elug draft icon.png For the latest EclipseLink documentation, please see http://www.eclipse.org/eclipselink/documentation/


Contents

Related Topics

This section provides information about understanding, using, and customizing the EclipseLink Workbench.

For information on using Workbench to configure sessions XML, refer to EclipseLink Sessions.


Introduction to the Workbench

Workbench is a separate component from the EclipseLink runtime – it lets you graphically configure descriptors and map your project. Workbench can verify the descriptor options, access the data source (either a database or an XML schema), and create the database schema. Using Workbench, you can define EclipseLink descriptors and configurations without using code.

The Workbench is primarily for developing when using the native EclipseLink API, MOXy, or EIS. When using JPA, other development tools such as Eclipse Dali, or Oracle JDeveloper can be used.

You can use Workbench during the development phase of the development process. Typically, this phase includes the following:

  1. Defining an object model (a set of Java classes) to describe and solve your problem.
  2. Creating a Workbench project, importing your Java classes and data sources, and using descriptors to describe how the Java classes map to your data source model.
  3. Creating an EclipseLink session and registering your descriptors. In your application, use the session to retrieve and store objects from and to the data source.

Workbench creates a <projectName>.mwp file to store all EclipseLink project information, including object model, descriptor, and session information.

The <projectName>.mwp file is used only by Workbench. Typically, the only time you need to modify the <projectName>.mwp file is to merge changes during application development by a team of developers (How to Merge Files).

Using Workbench, you export this information into a project.xml file that your EclipseLink enabled application reads at run time.

For more information on using Workbench as the development environment, see Introduction to EclipseLink Development Tools.

Configuring the Workbench Environment

Workbench reads its environment variables from the setenv script in the <ECLIPSELINK_HOME>/bin directory.

Before you launch Workbench, you must configure its environment as follows:

  1. Use a text editor to open the <ECLIPSELINK_HOME>/bin/setenv script.
    • For Windows, open the setenv.cmd file.
    • For UNIX, open the setenv.sh file.
  2. Ensure that the JAVA_HOME environment variable is set:
    • For Windows: set JAVA_HOME=C:/j2sdk1.5.0_04
    • For UNIX: JAVA_HOME=/usr/local/packages/java; export JAVA_HOME
      Note: If you have already set JAVA_HOME as a system environment variable, you can skip this step.
  3. Update the DRIVER_CLASSPATH environment variable to add the location of the following (if necessary):
    Note: Do not include any Java classes for your persistent business objects in the DRIVER_CLASSPATH variable. Instead, add these persistent business objects in your Workbench project classpath.
    • JDBC drivers – if you are using building Relational Projects.
    • Java EE Connector Architecture (JCA) adapters – if you are Building EIS projects.
    • JCA connector.jar file – if you are using EIS Projects.
      The connector.jar file contains javax.resource.cci and javax.resource.spi interfaces that EclipseLink EIS uses. Edit the workbench.cmd or workbench.sh file in <ECLIPSELINK_HOME>/utils/workbench/bin to change the path to this file.
      At run time, this connector.jar file (or its equivalent) must be on your application or application server classpath.
    • Oracle Database ORACLE_HOME/rdbms/jlib/xdb.jar file – if you are using Direct-to-XMLType Mappings with an Oracle9i or later database.
    • Custom Collection class that you use to override the default Collection class that EclipseLink uses with a mapping container policy.
      The following examples shows how to set the DRIVER_CLASSPATH variable for Windows system and for UNIX.

      Example: Setting DRIVER_CLASSPATH on Windows
      set DRIVER_CLASSPATH=C:\OraHome\jdbc\lib\ojdbc14.jar;C:\Attunity\Connect\Java\lib\attunityResourceAdapter.jar;C:\OraHome\rdbms\jlib\xdb.jar
      Note: If the path to your driver(s) contains spaces, you must enclose the path in double-quotes in the setenv.cmd file. For example: set DRIVER_CLASSPATH="C:\Program Files\some directory\driver.jar"

      Example: Setting DRIVER_CLASSPATH on UNIX
      DRIVER_CLASSPATH=/OraHome/jdbc/lib/ojdbc14.jar;/attunity/connect/java/lib/attunityResourceAdapter.jar;/OraHome/rdbms/jlib/xdb.jar; export JDBC_CLASSPATH
  4. Save and close the setenv script.
  5. Start the Workbench by launching the <ECLIPSELINK_HOME>\utils\workbench\bin\workbench.cmd or workbench.sh file.

Using Workbench

The following figure shows the primary parts of the Workbench window.

Workbench Window

Workbench Window

The numbered callouts in the previous figure identify the following user interface components:

  1. Menu bar: The menu bar contains menus for each Workbench function. Some objects also contain context-sensitive menus. See How to Use Menus for more information.
  2. Toolbars: The toolbars contain shortcuts to specific functions. See How to Use Toolbars for more information.
  3. Navigator window section: The Navigator window section shows the project navigation tree for all open projects (see How to Use the Navigator). Click the plus ( + ) or minus ( ) sign next to an object (or double-click the object) to expand or collapse the tree. When you select an object in the Navigator window section, its properties appear in the Editor window.
  4. Editor window section: The Editor window section contains specific property sheets and option tabs for the currently selected object. See How to Use the Editor for more information.
  5. Problems window section: The Problems window section shows messages and errors for the currently selected object in the Navigator window section (see How to Use the Problems Window). EclipseLink Workbench Error Reference (ELUG) contains detailed information on each error message.


How to Use Menus

Workbench contains the following two types of menus:


Using Menu Bar Menus

The menu bar, located at the top of the Workbench window, provides menus for each Workbench function. Some menus (such as Selected) are context-sensitive; the available options may vary, depending on the currently selected object.


Sample Menu Bar Menu

Sample Menu Bar Menu


Using Context Menus

When you right-click objects in the Navigator window, a context menu appears with functions specific to the selected object.


Sample Context Menu

Sample Context Menu


How to Use Toolbars

Workbench contains the following toolbars at the top of the window:

Toolbars provide tool tips: each toolbar button provides a brief description when you position the mouse pointer over it.


Using Standard Toolbar

The standard toolbar furnishes quick access to the standard menu options (File, Edit, Selected, and so on).


Standard Toolbar Buttons

Button Description Available for...

New Project button.

New

All

Open Project button

Open

All

Save button

Save

All

Save As button

Save as

All

Save All button

Save all

All

Close Project button

Close

All

Close All button

Close all

All

Export Deployment XML button

Export deployment XML for the selected projects

Projects

Refresh Selected Classes button

Refreshes selected classes

Projects

Add or Update Classes button

Add or refresh classes

Projects

Create New Class button

Create new class

Projects


Using Context Toolbar

The context toolbar provides quick access to functions for the currently selected object in the Navigator. The available buttons will vary, depending on which item you have selected.

You can also right-click the item and choose the appropriate option from the context menu.


Context Toolbar Buttons

Button Description Available for...

Login to Database button

Login to database

Databases

Logout of Database button

Logout of database

Databases

Add Table button

Add new table

Databases

Add or Update Tables from Database button

Add or update existing tables from database

Databases

Refresh from Database button

Refresh from database

Database tables

Remove Table button

Remove table or selected item

Database tables

Rename button

Rename table or selected item

Database tables

Import Schema button

Import schema

Schemas

Aggregate Descriptor button

Relational aggregate descriptor

Descriptors

Class Descriptor button

Relational class descriptor

Descriptors

EIS composite descriptor button

EIS composite descriptor

Descriptors

EIS Root Descriptor button

EIS root descriptor

Descriptors

XML descriptor button

XML descriptor

Descriptors

Direct to Field Mapping button

Direct-to-field mapping

Attributes in relational descriptors

Direct-to-XMLType Mapping button

Direct-to-XMLType mapping

Attributes in relational descriptors

Direct Collection Mapping button

Direct collection mapping

Attributes in relational descriptors

Direct Map Mapping button

Direct map mapping

Attributes in relational descriptors

Aggregate Mapping button

Aggregate mapping

Attributes in relational descriptors

One-to-one Mapping button

One-to-one mapping

Attributes in relational descriptors

Variable One-to-one Mapping button

Variable one-to-one mapping

Attributes in relational descriptors

One-to-many Mapping button

One-to-many mapping

Attributes in relational descriptors

Many-to-many Mapping button

Many-to-many mapping

Attributes in relational descriptors

Direct Mapping button

Direct mapping

Attributes in EIS descriptors

Direct Collection Mapping button

Direct collection mapping

Attributes in EIS descriptors

Composite Object Mapping button

Composite object mapping

Attributes in EIS descriptors

Composite Collection Mapping button

Composite collection mapping

Attributes in EIS descriptors

One-to-one Mapping button

One-to-one mapping

Attributes in EIS descriptors

One-to-many Mapping button

One-to-many mapping

Attributes in EIS descriptors

Direct-to-XML Mapping button

Direct-to-XML mapping

Attributes in XML descriptors

Direct Collection Mapping button

Direct collection mapping

Attributes in XML descriptors

Composite Object Mapping button

Composite object mapping

Attributes in XML descriptors

Composite Collection Mapping button

Composite collection mapping

Attributes in XML descriptors

Any Object Mapping button

Any object mapping

Attributes in XML descriptors

Any Collection Mapping button

Any collection mapping

Attributes in XML descriptors

Transformation Mapping button

Transformation mapping

Attributes in all descriptors

Unmap button

Unmap

Attributes in all descriptors

Session button

Session

Sessions configurations

Session Broker button

Session Broker

Sessions configurations

Named Connection Pool button

Named connection pool

Server sessions

Sequence Connection Pool button

Sequence connection pool

Server sessions

Write Connection Pool button

Write connection pool

Server sessions

Rename button

Rename

Database sessions, session brokers

Delete Session button

Delete session

Database sessions, session brokers

How to Use the Navigator

EclipseLink displays the items included in each project (descriptors, mappings, data source, and so on) in the Navigator on the left side of the Workbench window, as this figure shows.


Sample Navigator

Sample Navigator

The numbered callouts on this figure identify the following user interface components:

  1. Project (relational project)
  2. Package
  3. EclipseLink Descriptor (relational descriptor)
  4. Attribute/mapping (direct to field mapping)
  5. Unsaved/changed item
  6. Database
  7. Database table

Click the plus ( + ) or minus () sign next to the item, or double-click the item name to expand or collapse the item.

Workbench identifies items that have been changed but not yet saved by adding an asterisk ( * ) in front of the item name.

When you select an item in the Navigator, its properties appear in the Editor (see How to Use the Editor).

To perform specific functions for an item, select the item in the Navigator and do one of the following:

For information on using the Navigator with a database in relational projects, see How to Use Database Tables in the Navigator Window.

For information on using the Navigator with an XML schema in EIS projects (using XML records) and XML projects, see How to Use XML Schemas in the Navigator.


Active and Inactive Descriptors

Inactive descriptors appear dimmed in the Navigator. Inactive descriptors are not registered with the session when the project is loaded into Java. This feature lets you define and test subsets of descriptors. To activate or deactivate a descriptor, right-click the descriptor and select Activate/Deactivate Descriptor from the context menu.


Sample Active and Inactive Descriptors

Sample Active and Inactive Descriptors

The numbered callouts show the following user interface components:

  1. Inactive descriptor
  2. Active descriptor


Errors and Missing Information

Caution / Warning icon If an element in the project (such as a descriptor or mapping) contains an error or some deficiency (sometimes called neediness), a warning icon appears beside the element icon in the Navigator, and Workbench displays a message in the Problems window.

EclipseLink Workbench Error Reference (ELUG) contains more information on each Workbench error message.


How to Use the Editor

The Editor, on the right side of the Workbench window, displays the property sheet associated with the currently selected item in the Navigator, as this figure shows.


Sample Editor

Sample Editor

The numbered callouts identify the following user interface components:

  1. Selected element (from the Navigator)
  2. Editor property tabs


How to Use the Problems Window

Caution / Warning icon If an element in the project (such as a descriptor or mapping) contains an error or some deficiency (sometimes called neediness), the Workbench displays a caution icon (represented by a yellow triangle with a black exclamation point in the middle) to the left of the deficient element in the Navigator (see How to Use the Navigator) and displays a message in the Problems window as the Sample Deficient Mapping figure shows.

If you select the error, then Workbench displays the complete error message in the Problems window. EclipseLink Workbench Error Reference (ELUG) contains detailed information on each error message.

Sample Deficient Mapping

Sample Deficient Mapping

Double-click any error message in the Problems window to automatically highlight the specific node in the Navigator. To display or hide the Problems window, select Window > Show Problems from the menu.

You can also create a status report that includes all errors in a selected project.

Using Workbench Preferences

To customize Workbench, select Tools > Preferences from the menu. The Preferences dialog box appears.

Preferences Dialog Box

Preferences Dialog Box

Workbench provides the following preferences:

Use this dialog box to configure Workbench preferences. After changing preferences, you must restart Workbench.

To import your preferences from an existing file, click Import and select the file.

To export your preferences, click Export and select a directory location and filename.


How to Use General Preferences

Use the General preferences to customize the look and feel (the graphical user interface) of Workbench as well as to specify any proxy information required to access the Internet (for example, to allow EclipseLink to access XML schemas hosted on Internet sites). Follow these steps to customize the General preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Select General in the Category window.
    Preferences – General Dialog Box
    Preferences – General Dialog Box

  3. Complete each field on the Preferences – General dialog box and click OK.


Use the following information to enter data in each field of the dialog box:

Field Description
Display Splash Screen Specify if Workbench should show the graphical splash screen when starting.
Look and Feel Select the look and feel to use for Workbench.
Size of recently opened files list

Select the number of projects to maintain in the File > Reopen option. See How to Open Existing Projects for more information.

HTTP Proxy Host Specify if your PC requires a proxy server to access the internet.
HTTP Proxy Port Specify the port used by your proxy host.
Network Connect Timeout Specify the timeout (in seconds) to establish a network or internet connection.
Network Read Timeout Specify the timeout (in seconds) when accessing data from a network or internet connection.
Reopen Projects on Startup Select to reopen the projects that were open the last time you exited the Workbench.


You must restart Workbench to apply the changes.


How to Use Help Preferences

The EclipseLink Workbench online help is web-based. Use the Help preferences to define the location of your web browser.

Follow these steps to customize the Help preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Select General > Help in the Category window. The Help dialog box appears.
    Preferences – Help Dialog Box
    Preferences – Help Dialog Box

  3. Click Browse and select your HTML web browser.
  4. Click OK.

Note: If your location requires a proxy to browse external web pages, be sure to complete the Proxy fields on the General Preferences page.

How to Use Mappings Preferences

Use the Mappings preferences to specify general mapping preferences. Follow these steps to set the Mapping preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Select Mappings in the Category window. The Mappings dialog box appears.
    Preferences – Mappings Dialog Box
    Preferences – Mappings Dialog Box

  3. Complete each field on the Preferences - Mappings dialog box and click OK.


Use the following information to enter data in each field:

Field Description
Allow changing query type Configure whether or not Workbench always allows, never allows, or prompts before allowing you to change the query type associated with a descriptor.
Allow changing query format Configure whether or not Workbench always allows, never allows, or prompts before allowing you to change the configuration of a query associated with a descriptor.


How to Use Class Preferences

Use the Class preferences to specify how Workbench maintains classes when renaming or editing a zero-argument constructor. Follow these steps to set the Class preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Expand Mappings in the Category window and select Class.
    Preferences – Mappings – Class Dialog Box
    Preferences  –  Mappings  –  Class Dialog Box

  3. On the PreferencesMappingsClass dialog box, specify how Workbench maintains classes when renaming or editing a zero-argument constructor.


How to Use Database Preferences

Use the Database preferences to specify custom database divers and connection URLs for Workbench. These drivers and URLs can then be used when defining database logins. Follow these steps to set the Database preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Expand Mappings in the Category window and select Database.
    Preferences – Mappings – Database Preferences Dialog Box
    Preferences – Mappings – Database Preferences Dialog Box

  3. Enter data in each field on the Preferences – Mappings – Database dialog box and click OK.

Use the following information to enter data in each field:


Field Description
Database Driver Enter the custom database driver class name.
Connection URL Enter the custom database connection URL.


How to Use Sessions Configuration Preferences

Use the Sessions preferences to specify default classpaths to be added to each newly created EclipseLink sessions configuration for features that require an external Java class (for example, session event listeners). The entries added here will automatically appear on the Sessions Configuration property sheet. Follow these steps to set the Sessions Configuration preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Select Sessions Configuration in the Category window.
    Preferences – Sessions Configuration Dialog Box
    Preferences – Sessions Configuration Dialog Box

To add a JAR or ZIP file, click Add Entry or Browse and add the JAR or ZIP files that contain the default compiled Java classes for this sessions configuration.

To remove a JAR or ZIP file, select the file and click Remove.

To change the order in which EclipseLink searches these JAR or ZIP files, select a file and click Up to move it up, or click Down to move it down in the list.


How to Use New Names Preferences

Use the New Names preferences to specify the default values and names of newly created sessions, session brokers, and connection pools. Follow these steps to set the New Names preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Expand Sessions Configuration in the Category window and select New Names.
    Preferences – Sessions Configuration – New Names Dialog Box
    Preferences – Sessions Configuration – New Names Dialog Box

  3. Complete each field on the Preferences – Sessions Configuration – New Names dialog box and click OK.

Use the following information to enter data in each field:

Field Description
Sessions Configuration

Specify the default name for newly created sessions configuration files (default, sessions.xml). See Creating a Sessions Configuration for more information.

Session

Specify the default name for newly created sessions (default, Session). See Introduction to the Session Creation for more information.

Broker

Specify the default name for newly created session brokers (default, SessionBroker). See Creating Session Broker and Client Sessions for more information.

Connection Pool

Specify the default name for newly created connection pools (default, ConnectionPool). See Creating an Internal Connection Pool for more information.


How to Use Session Platform Preferences

Use the Platform preferences to specify the default data source type for newly created sessions. The type selected here will automatically appear on the Create New Session dialog box. Follow these steps to set the Platform preferences:

  1. Select Tools > Preferences from the menu. The Preferences dialog box appears.
  2. Expand Sessions Configuration in the Category window and select Platform.
    Preferences – Sessions Configuration – Platform Preferences Dialog Box
    Preferences – Sessions Configuration – Platform Preferences Dialog Box

  3. Complete each field on the Preferences – Sessions Configuration – Platform dialog box and click OK.

Use the following information to enter data in each field:

Field Description
Use Server Platform

Specify the default application server platform for newly created sessions configuration files (default, sessions.xml). See Creating a Sessions Configuration for more information.

Default Data Source Type

Select the default data source type (Database, EIS, or XML) and platform for newly created sessions. See Configuring the Server Platform for more information.

Using Databases

In relational projects, when you expand the database object in the Navigator, Workbench displays the database tables associated with the project. You can associate tables by importing them from the database, or by creating them within Workbench.

Sample Database Tables

Sample Database Tables

The following numbered callouts identify the following database icons.

  1. Project
  2. Database
  3. Database table

Each database table property sheet contains the following tabs in the Editor:

  • Columns – Add or modify the table's fields, and specify each field's properties.
  • References – Specify references between tables.

This section includes information on the following topics:


How to Use Database Tables in the Navigator Window

This section describes the following options:

See How to Use Database Tables in the Editor Window for more information.


Logging In and Out of a Database

To log in or out of a relational database, do the following:

  1. Create a database login (see Introduction to Database Login Configuration).
  2. To log in to a relational database, right-click the database object in the Navigator, and choose Log In to Database from the context menu or choose Selected > Log In to Database from the menu.
  3. To log out of a relational database, right-click the database object in the Navigator and choose Log Out of Database from the context menu or choose Selected > Log Out of Database from the menu.


Creating New Tables

To create a new database table within Workbench, use the following procedure:

  1. Select the database object in the Navigator window and click Add New Table Add a New Table button. The New Table dialog box appears.
    You can also right-click the database object and choose Add New Table from the context menu, or choose Selected > Add New Table from the menu.
    New Table Dialog Box
    New Table Dialog Box

  2. Complete each field on the New Table dialog box and click OK.


Use the following information to enter data in each field:

Field Description
Catalog

Use to identify specific database information for the table. Consult your database administrator for more information.

Schema

Use to identify specific database information for the table. Consult your database administrator for more information.

Table Name Specify the name of this database table.


Workbench adds the database table to the project.

Although the database table has been added to the project, it has not been written to the actual database. See Generating Tables on the Database for more information on creating the table in the database.

Continue with How to Use Database Tables in the Editor Window to use these tables in your project.


Importing Tables from a Database

Workbench can automatically read the schema for a relational database and import the table data into the project as long as your JDBC driver supports the following JDBC methods:

  • getTables
  • getTableTypes
  • getImportedKeys
  • getCatalogs
  • getPrimaryKeys

The JDBC driver must be on the Workbench classpath (see Configuring the Workbench Environment).

To import tables from the database, use the following procedure:

  1. Select the database object in the Navigator, and click Add or Update Existing Tables from Database Add/Update Existing Tables from Database. The Import Tables from Database dialog box appears.
    You can also right-click on the database object in the Navigator and choose Add or Update Existing Tables from Database from the context menu or choose Selected > Add/Update Existing Tables from Database from the menu.
    Import Tables from Database Dialog Box
    Import Tables from Database Dialog Box

    The following numbered callouts identify the following user interface components:
    1. Filters
    2. Database tables that match the filters
  2. Complete each field on the Import Tables from Database dialog box and click OK.


Use the following information to enter data in each field of the dialog box:

Field Description
Table Name Pattern Specify the name of database table(s) to import. Use percent character ( %) as a wildcard. Tables that match the Table Name Pattern can be imported.
Catalog Specify the catalog of database table(s) to import.
Schema Pattern Specify the schema of database table(s) to import.
Table Type Specify the type of database table(s) to import.
Available Tables Click Get Table Names to make EclipseLink display tables that match Table Name Pattern, Catalog, Schema Pattern, and Table Type settings.
Selected Tables

Select the tables in the Available Tables area to import, and click the right-arrow button. EclipseLink adds the table to the Selected Tables field. Click OK to import the tables from the database into the Workbench project.

Import Fully Qualified Names Specify whether or not the tables' names are fully qualified against the schema and catalog.


Examine each table's properties to verify that the imported tables contain the correct information. See How to Use Database Tables in the Editor Window for more information.

Removing Tables

To remove a database table from the project, use the following procedure:

  1. Select a database table in the Navigator, and click Remove Selected Item Remove Table button on the toolbar. Workbench prompts for confirmation.
    You can also right-click on the database object and choose Remove from the context menu or choose Selected > Remove from the menu.
  2. Click OK. Workbench removes the table from the project.

Note: Although you have removed the table from the Workbench project, the table remains in the database.


Renaming Tables

To rename a database table in the Workbench project, use the following procedure:

  1. Select a database table in the Navigator, and click Rename on the toolbar. The Rename dialog box appears.
    You can also right-click on the table and choose Rename from the context menu or choose Selected > Rename from the menu.
  2. Enter a new name and click OK. Workbench renames the table.

Note: Although you have renamed the table in the Workbench project, the original table name remains in the database.


Refreshing Tables from the Database

To refresh (that is, reload) the database tables in the Workbench project, use the following procedure:

  1. Select the database table in the Navigator, and click Refresh from Database on the toolbar.
    You can also right-click on the database table and choose Refresh from Database from the context menu or choose Selected > Refresh from Database from the menu. Workbench reloads the database table.
  2. When refreshing tables from the database, if there are multiple database tables with similar names, the Duplicate Tables dialog box appears.

    Duplicate Table Dialog Box
    Duplicate Table Dialog Box

  3. Select the specific database table to update, and then click OK.

How to Use Database Tables in the Editor Window

When you select a database table in the Navigator, its properties appear in the Editor. Each database table contains the following property tabs:

  • Columns – Add or modify the table fields, and specify each field properties.
  • References – Specify references between tables.

This section describes how to use these tabs to configure the following:


Working with Column Properties

Use the database table's Column tab to specify properties for the database table's fields.

To specify a table's column properties, use this procedure:

  1. Select a database table in the Navigator. The table's property sheet displays in the Editor.
  2. Click the Columns tab.
    Fields Properties
    Fields Properties

  3. Enter data in each field on the Columns tab. Use the scroll bar to display the additional field.

Use the following information to fill each column on the Columns tab:

Field Description
Name Specify the name of the field.
Type

Use the drop-down list to select the field's type. Note: The valid values will vary, depending on the database.

Size Specify the size of the field.
Sub-Size Specify the sub-size of the field.
Allows Null Specify if this field can be null.
Unique Specify whether the value must be unique within the table.
Primary Key

Specify whether or not this field is a primary key for the table (see Setting a Primary Key for Database Tables).

Identity Use to indicate a Sybase, SQL Server or Informix identity field.


Note: Some properties may be unavailable, depending on your database type.


To add a new field, click Add.

To remove a field, select the field and click Remove.

To rename a field, select the field and click Rename.


Setting a Primary Key for Database Tables

To set a primary key(s) for a database table, use this procedure:


Note: Workbench can automatically import primary key information if supported by the JDBC driver.


  1. Select a database table in the Navigator. Its property sheet appears in the Editor.
  2. Click the Columns tab.Click the Columns tab.
    Setting Primary Key for a Database Table

    Setting Primary Key for a Database Table

  3. Select the Primary Key field(s) for the table.


Creating Table References

References are table properties that contain the foreign key; they may or may not correspond to an actual constraint that exists on the database. Workbench uses these references when you define relationship mappings and multiple table associations.

When importing tables from the database, Workbench can automatically create references (if the driver supports this), or you can define references from the workbench. See Importing Tables from a Database.

To create a new table reference, use this procedure:

  1. Select a database table in the Navigator. The table's properties display in the Editor.
  2. Click the References tab.
    References Tab
    Description of Figure 4-23 follows
    The following numbered callouts identify the following user interface components:
    1. Table References area
    2. Key Pairs area
  3. In the References area, click Add. The New Reference dialog box appears.
    New Reference Dialog Box
    New Reference Dialog Box

  4. Complete each field on the new Reference dialog box and click OK.


Use the following information to enter data in each field of the dialog box:

Field Description
Enter Name of New Reference Specify the name of the reference table. If you leave this field blank, Workbench automatically creates a name based on the format: SOURCETABLE_TARGETTABLE.
Select the Source Table Specify the name of the source database table (the currently selected table in the Navigator).
Select the Target Table Use the list to specify the target table for this reference.
On Database Specify if you want to create the reference on the database when you create the table. Not all database drivers support this option.


Continue with Creating Field Associations.


Creating Field Associations

For each table reference, you can specify one or more field associations that define how fields in the source table relate to fields in the target table. See Creating Table References.

To create new field references, use this procedure:

  1. Select a database table in the Navigator. The table's properties display in the Editor.
  2. Click the References tab.
    References Tab
    References Tab

    The following numbered callouts identify the following user interface components:
    1. Table references area
    2. Key pairs area
  3. Select a table reference from the references area.
  4. To create a new key pair, click Add in the key pairs area and complete each field in the key pairs area using the following information:


Field Description
Table References Area
Name
Specify the name of this table reference
Target Table
Specify the database table that is the target of this reference.
On Database
Specify if the reference exists on the database.
Key Pairs Area
Source Column
Select the database field from the source table.
Target Column
Select the database field from the target table.

How to Generate Data from Database Tables

Workbench can automatically generate a variety of information from the database tables. This section describes the following:


Generating SQL Creation Scripts

Using the Workbench, you can generate SQL scripts that you can use to create tables in a relational database.

To automatically generate SQL scripts to create the tables in a project, use this procedure:

  1. Select the database table(s) in the Navigator.
  2. Right-click the table(s) and choose Generate Creation Script for > Selected Tables or All Tables from the context menu. The SQL Creation Script dialog box appears.
    You can also choose Selected > Generate Creation Script for > Selected Tables or All Tables from the menu.
    SQL Creation Script Dialog Box
    Creation Script Dialog Box

Copy the script and paste it into a file. You may need to edit the file to include additional SQL information that Workbench could not generate. If the database table or column name is an SQL reserved word, you must edit the SQL script and enclose the database table or column in quotes.


Note: If EclipseLink cannot determine how a particular table feature should be implemented in SQL, it generates a descriptive message in the script.

Generating Classes and Descriptors from Database Tables

Workbench can automatically generate Java class definitions, descriptor definitions, and associated mappings from the information in database tables. You can later edit the generated information if necessary.

For each table, Workbench does the following:

  • Creates a class definition and a descriptor definition.
  • Adds attributes to the class for each column in the table.
  • Automatically generates access methods, if specified.
  • Creates direct-to-field mappings for all direct (nonforeign key) fields in the table.
  • Creates relationship mappings (one-to-one and one-to-many) if there is sufficient foreign key information. You may be required to determine the exact mapping type.

Note: Class and attribute names are generated based on the table and column names. You can edit the class properties to change their names.


To generate classes and descriptors from database tables, use the following procedure:

  1. Select the database table(s) in the Navigator.
  2. Right-click the table(s) and choose Generate Classes and Descriptors from > Selected Tables or All Tables from the context menu. Workbench prompts you to save your project.
    You can also choose Selected > Generate Classes and Descriptors from > Selected Tables or All Tables from the menu.
  3. Click Yes. The Generate Classes and Descriptors dialog box appears.
    Generate Classes and Descriptors Dialog Box
    Generate Classes and Descriptors Dialog Box

    Complete each field on the Generate Classes and Descriptors dialog box and click OK. Use the following information to enter data in each field:
    Field Description
    Package Name Specify the name of package to generate. The package name must comply with Java naming standards.
    Generate Accessing Methods Specify if Workbench generates accessing methods for each class and descriptor.

  4. If the table contains foreign key fields that may represent relationship mappings, then the Choose Relationships to Generate dialog box appears.
    Choose Relationships to Generate Dialog Box
    Choose Relationships to Generate Dialog Box

  5. Select an entry from Potential Relationships and click the 1:1 Mapping One to One mapping button or 1:M Mapping One to Many mapping button button, located between the Potential Relationships and Selected Relationships windows. See Introduction to Relational Mappings for more information on mappings.
    You can also specify whether the relationships are bidirectional. See Configuring Bidirectional Relationship for more information.
  6. Click OK to automatically create the relationships.

The newly created descriptors appear in the Navigator of Workbench.

Generating Tables on the Database

To create a table in the database, based on the information in Workbench, use this procedure:


Note: You must log in the database before creating tables. See Logging In to the Database for more information.


  1. Select the database table(s) in the Navigator.
  2. Right-click the table(s) and choose Create on Database > Selected Tables or All Tables from the context menu.
    You can also create tables by selecting Selected > Create on Database > Selected Tables or All Tables from the menu.

Workbench creates the tables on the database.

Alternatively, you can generate tables at run time by exporting the information in Workbench to a TableCreator class (see Introduction to the Schema Manager).

Using XML Schemas

For XML and EIS projects, Workbench maps each EclipseLink descriptor to your XML schema.

This section includes information on the following topics:


How to Use XML Schemas in the Navigator

After you import one or more XML schemas into your project (see How to Import an XML Schema) and you expand the schema object in the Navigator, Workbench displays the schemas associated with the project.

Sample XML Schemas

Sample XML Schemas

The following numbered callouts identify the following schema icons:

  1. Project
  2. Schemas object
  3. Specific schema

For more information, see the following:


How to Use an XML Schema Structure

When you select a specific XML schema in the Navigator, you can display the structure and details of the schema using the Schema Structure tab.

To display the structure and details of a schema, use this procedure:

  1. Select a schema element in the Navigator. Its properties appear in the Editor.
  2. Click the Schema Structure tab. The Schema Structure tab appears.
  3. Select an element in the schema. The element's details appear.
    Schema Structure Tab
    Schema Structure Tab

  4. Review the fields on the Schema Structure tab.

Use the following information to verify data in each field in the Schema Document Info tab:


Field Description
Schema Structure Displays the elements of the schema, listed in alphabetical order, in an expandable or collapsible tree structure.
Details Displays detailed information (such as name and type) for the currently selected element in the Schema Structure area.


These fields are for display only and cannot be changed in Workbench.


How to Import an XML Schema

The first step in configuring an EIS project (using XML records) or XML project is importing the XML schema(s) that your project uses.

When you import a schema, you define a schema reference that gives EclipseLink the information it needs to locate the schema itself. Anytime after you import an XML schema, you can update the schema reference (see How to Configure an XML Schema Reference) if necessary.

After importing an XML schema, you can configure XML schema namespaces (see How to Configure XML Schema Namespace).

To import an XML schema into an EIS project (using XML records) or an EIS project, use this procedure:

  1. Right-click the schemas element in the Navigator and select Import Schema from the context menu. The Import Schema dialog box appears.
    Import Schema Dialog Box

    Import Schema Dialog Box

  2. Fill the Import Schema dialog box with data, and then click OK. Workbench will add the schema to the project.


Use the following information to enter data in each field in the Import Schema dialog box:

Field Description
Name Specify the name of this schema. This is the display name that Workbench uses. It can be different than the name you specify when you configure Source.
Source Select how Workbench should import the schema.
File

Specify that Workbench should import the schema from a file. Enter the fully qualified directory path and filename of the schema file.

URL

Specify that Workbench should import the schema using a URL. Enter the complete URL of the schema file.

Note: When importing schemas by URL, ensure you have set your proxy information correctly.

See How to Use General Preferences for more information.

Classpath Specify that Workbench should import the schema from the project classpath.
Resource Name

Enter the fully qualified name of the XML schema file including the name of the package of which it is a part. For example, if your XML schema mySchema.xsd is in C:\project\config and you add this directory to your project classpath (see Project Support for Project Classpath), specify a resource name of project.config.mySchema.xsd.


To reimport a specific schema, right-click on the specific schema in the Navigator and select Reimport Schema from the context menu.

To reimport all schemas in a project, right-click on Schemas in the Navigator and select Reimport All Schemas from the context menu.

To change a schema's source, right-click on the specific schema in the Navigator window and select Properties from the context menu. The Schema Properties dialog appears.


How to Configure an XML Schema Reference

After you import an XML schema (see How to Import an XML Schema), you can update its source by configuring the schema reference.


How to Configure an XML Schema Reference Using Workbench

To specify the source of a schema, use this procedure:

  1. Select a schema element in the Navigator. Its properties appear in the Editor.
  2. Click the Schema Document Info tab. The Schema Document Info tab appears.
    Schema Document Info Tab – Source Field
    Schema Document Info Tab – Source Field

  3. Click Edit to select a new source for the selected schema. The Schema Properties dialog box appears.
    Schema Properties Dialog Box
    Schema Properties Dialog Box

Complete the Schema Properties dialog box and click OK. Workbench adds the schema to the project.

Use the following information to complete each field in the Schema Properties dialog box:


Field Description
Name Specify the name of this schema. This is the display name that Workbench uses. It can be different than the name you specify when you configure Source.
Source Select how Workbench should import the schema.
File

Specify that Workbench should import the schema from a file. Enter the fully qualified directory path and filename of the schema file.

URL

Specify that Workbench should import the schema using a URL.

Enter the complete URL of the schema file.

Note: When importing schemas by URL, ensure you have set your proxy information correctly. See How to Use General Preferences for more information.

Classpath Specify that Workbench should import the schema from the project classpath.
Resource Name

Enter the fully qualified name of the XML schema file including the name of the package of which it is a part. For example, if your XML schema mySchema.xsd is in C:\project\config and you add this directory to your project classpath (see Configuring Project Classpath, specify a resource name of project.config.mySchema.xsd.


How to Configure an XML Schema Reference Using Java

Use Java to configure schema reference. Create a descriptor amendment method (see Configuring Amendment Methods) that instantiates the appropriate type of XMLSchemaReference (XMLSchemaClassPathReference, XMLSchemaFileReference, or XMLSchemaURLReference) and configures the descriptor with it, as follows:

  • If you are using EISDescriptors, the EclipseLink runtime does not use the schema reference; no further configuration is required.
  • If you are using XMLDescriptors, configure the descriptor with the XMLSchemaReference using XMLDescriptor method setSchemaReference.


How to Configure XML Schema Namespace

As defined in http://www.w3.org/TR/REC-xml-names/, an XML namespace is a collection of names, identified by a URI reference, which are used in XML documents as element types and attribute names. To promote reusability and modularity, XML document constructs should have universal names, whose scope extends beyond their containing document. XML namespaces are the mechanism which accomplishes this.

When you import an XML schema (see How to Import an XML Schema) such as the one that the XML Schema with Namespace Options example shows, Workbench organizes the various namespaces that the XML schema identifies, as the Workbench XML Schema Categories table shows.


XML Schema with Namespace Options

<xsd:schema
    xmlns:<prefix>="<URI>"             <! –  Workbench Built-in Namespace  – >
    targetNamespace="<URI>"            <! –  Workbench Target Namespace  – >

    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    version="10.1.3">
    <xsd:import                        <! –  Workbench Imported Namespace  – >
        namespace="http://xmlns.oracle.com/ias/xsds/opm"
        schemaLocation="object-persistence_1_0.xsd"
    />
...
</xsd:schema>


Workbench XML Schema Categories

Workbench Category Defined By Purpose When Needed

Built-in

xmlns:<prefix>="<URI>"

Provides access to types defined in other XML schemas for use as is.

If your project uses more than one XML schema or if you want to use xsi or xsd types.

Target

targetNamespace="<URI>"

The namespace you use to qualify the types you define for your application. If set, all XML documents that use these types must use this namespace qualifier.

You may need to specify a target namespace depending on how element and attribute form options are set (see Element and Attribute Form Options).

Imported

xsd:import

Provides access to types defined in the corresponding built-in XML schema so that you can extend the built-in types. Extended types must be qualified by the target namespace.

If your project uses more than one XML schema and you want to extend one or more built-in types.


For more information, see XML Namespaces Overview.


How to Configure XML Schema Namespace Using Workbench

To specify the namespaces of a schema, use this procedure:

  1. Select a schema element in the Navigator. Its properties appear in the Editor.
  2. Click the Schema Document Info tab. The Schema Document Info tab appears.
    Schema Document Info Tab – Namespaces Field
    Schema Document Info Tab – Namespaces Field

  3. Complete the Namespaces fields on the Schema Document Info tab.


Use the following information to complete each Namespaces field in the tab:

Field Description
Built-in Namespaces

All namespaces defined by xmlns:<prefix>="<URI>".

Note that when a schema is imported to the Workbench (see How to Import an XML Schema), none of the built-in namespaces' URLs are selected. If you are using inheritance, declare the built-in namespace with xsi prefix. Otherwise, EclipseLink will throw exceptions.

Target Namespaces All namespaces defined by targetNamespace="<URI>".
Imported Namespaces All namespaces defined by xsd:import.
Prefix

Double-click in the Prefix field to specify the prefix that corresponds to the given namespace.

When the EclipseLink runtime marshalls (writes) an object to an XML document, it uses the namespace prefixes you specify here.

When the EclipseLink runtime unmarshalls (reads) an XML document, the document may use any prefix value as long as it corresponds to the appropriate namespace. For more information, see EclipseLink Runtime Namespace Resolution.

Declare

When selected, XML documents must use the corresponding URI qualifier when referring to types from this namespace. XML documents may use a different prefix value as long as that value is associated with the appropriate namespace URI. For more information, see EclipseLink Runtime Namespace Resolution.


How to Configure XML Schema Namespace Using Java

Using Java, to configure XML schema namespaces for an EIS descriptor (with XML records) or an XML descriptor, create a descriptor amendment method (see Configuring Amendment Methods) that uses EISDescriptor or XMLDescriptor method getNamespaceResolver to configure the descriptor's NamespaceResolver accordingly, as this example shows.


Configuring Namespaces

public void addToDescriptor(ClassDescriptor descriptor) {
    descriptor.getNamespaceResolver.put(
        prefix,
        namespaceURI
    );
}


Using Classes

Using Workbench, you can create Java classes and packages. This section includes information on the following:


How to Create Classes

We recommend that you develop your Java classes using an IDE such as Eclipse and import these existing classes into Workbench (see How to Import and Update Classes)

However, it is sometimes convenient to create and configure classes in Workbench: for example, when generating an object model from a database schema.

This section includes information on using Workbench to create Java classes.

For more information on using Workbench to edit classes, see How to Create Classes.


How to Create Classes Using Workbench

To create new classes and packages from within Workbench, use this procedure:

  1. Select the project in the Navigator and click Create New Class Create New Class button.
    You can also right-click the project in the Navigator and choose Create New Class from the context menu or choose Selected > Create New Class from the menu.
    Add Class Dialog Box
    Add Class Dialog Box

  2. Enter data in each field on the Add Class dialog box and click OK. Workbench will add the new class to the project in the Navigator.

Use the following information to enter data in each field on the Add Class dialog box:

Field Description
Package Name Choose an existing package or enter a new package name. If blank, Workbench uses the default package name.
New Class Name Enter a class name. The New Class Name must be unique within the package.


For more information on using Workbench to edit classes, see How to Configure Classes.

How to Configure Classes

We recommend that you develop your Java classes using an IDE such as Eclipse and import these existing classes into Workbench (see How to Import and Update Classes)

However, it is sometimes convenient to create (see How to Create Classes) and configure classes in Workbench: for example, when generating an object model from a database schema.

This section describes using Workbench to edit classes, including the following:


Configuring Class Information

This section includes information on using the workbench to configure class information.


Using Workbench

To configure class and superclass information, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Class tab.
    Class Tab, Class Information Fields
    Class Tab, Class Information Fields

  4. Complete the class information fields on the Class Info tab.

Use the following information to enter data in each field on the tab:

Field Description
Name The name of the class. This field is for display only.
Superclass Click Browse and select a class and package that contains the class (that is, the superclass).


Configuring Class Modifiers

This section includes information on using the workbench to configure class modifiers.


Using Workbench

To configure class modifiers, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Class tab.
    Class Tab, Class Modifiers Fields
    Class Tab, Class Modifiers Fields

  4. Complete the Modifiers fields on the Class tab.


Use the following information to enter data in each field on the tab:

Field Description
Access Modifiers

Use to specify whether the class is accessible publicly or not. Only public classes are visible to the Workbench.

Other Modifiers Specify if the class is Final or Abstract, or both. Final classes are not included in the superclass selection lists for other classes to extend.


Configuring Class Interfaces

This section includes information on using the workbnech to specify the interfaces implemented by a class. You can choose any interface in the Workbench classpath (see Configuring Project Classpath).

Although you may add interfaces to a project directly (see How to Import and Update Classes), you do not need to do so in order to configure a class to implement an interface.


Using Workbench

To implement interfaces, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Class tab.
    Class Tab, Interfaces Implemented Fields
    Class Tab, Interfaces Implemented Fields

  4. Complete the Iterfaces Implemented field on the tab.


Use the following information to enter data in the Interfaces Implemented field on the Class tab:

Field Description
Interfaces Implemented

To add an interface, click Add. The Choose Class dialog box appears. In the dialog box, select the interface and package. To remove an interface, select the interface and click Remove.

Adding Attributes

This section includes information on using the workbench to add an attribute to a class.


Using Workbench
  • To add a new attribute (field) to the descriptor, click Add.
  • To delete an existing attribute, select the attribute and click Remove.
  • To rename an existing attribute, select the attribute and click Rename.

The Attributes tab contains the following tabs:

  • General
  • Accessors

Configuring Attribute Modifiers

This section includes information on using the workbench to configure attribute modifiers.


Using Workbench

To specify access modifiers, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Attributes tab. The Attributes tab contains two sub-tabs.
  4. Click the General tab.
    Attributes Tab, Modifiers Fields
    Attributes Tab, Modifiers Fields

  5. Complete the Modifiers fields on the Attributes tab.


Use the following information to enter data in the Modifiers fields on the Attributes tab:

Field Description

Access Modifiers

Specify how the attribute is accessible:

  • Public iconPublic
  • Protected iconProtected – only visible within its own package and subclasses.
  • Private iconPrivate – not visible for subclasses
  • Default iconDefault – only visible within its own package

Other Modifiers

Specify whether the attribute is Final, Static, Transient, or Volatile.

Note: Selecting some modifiers may disable others.


Configuring Attribute Type Declaration

This section includes information on using the workbench to configure attribute type declaration.


Using Workbench

To specify attribute type declaration, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Attributes tab. The Attributes tab contains two sub-tabs.
  4. Click the General tab.
    Attributes Tab, Type Declaration Fields
    Attributes Tab, Type Declaration Fields

  5. Complete the Type Declaration fields on the Attributes tab.


Use the following information to enter data in Type Declaration fields on the Attributes tab:

Field Description
Type Click Browse and select a class and package for the attribute.
Dimensionality Specify the length of an array. This field applies only if Type is an array.
Value Type

Click Browse and select a class and package for the attribute. This field applies for ValueHolderInterface types only.

Map Key Type

Click Browse and select a class and package for the attribute. This field applies for Map types only.

Map Value Type

Click Browse and select a class and package for the attribute. This field applies for Map types only.

Element Type

Click Browse and select a class and package for the attribute. This field applies for List types only.

Configuring Attribute Accessing Methods

This section includes information on using the workbench to configure attribute accessing methods. If you change an attribute and regenerate the accessing methods, EclipseLink does not remove any previously generated methods.


Using Workbench

To specify attribute accessing methods, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Attributes tab. The Attributes tab contains two sub-tabs.
  4. Click the Accessors tab.
    Attributes Tab, Accessors Fields
    Attributes Tab, Accessors Fields

  5. Complete the Accessors fields on the Attributes tab. Click Generate Methods to automatically create the required method.

Use the following information to complete the Accessors fields on the Attributes tab:

Field Description
Get Method

Choose the get method for the attribute. This field applies for non-Collection types only.

Set Method

Choose the set method for the attribute. This field applies for non-Collection types only.

Add Method

Choose the add method for the attribute. This field applies for List and Map types only.

Remove Method

Choose the remove method for the attribute. This field applies for List and Map types only.

Value Holder Get Method

Choose the method used to return the ValueHolderInterface type. This field applies for ValueHolderInterface types only.

Value Holder Set Method

Choose the method used to set the ValueHolderInterface type. This field applies for ValueHolderInterface types only.

Value Get Method

Choose the method used to return the actual value. This field applies for ValueHolderInterface types only.

Value Set Method

Choose the method used to set the actual value. This field applies for ValueHolderInterface types only.


Adding Methods

This section includes information on the workbench to add a method to a class.


Using Workbench

To add or remove methods, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Methods tab.
    Class Info – Methods Tab
    Class Info – Methods Tab

To add a new method to the descriptor, click Add.

To delete an existing method, select the method and click Remove.

To rename an existing method, select the method and click Rename.


Configuring Method Modifiers

This section includes information on using the workbench to configure method modifiers.


Using Workbench

To specify access modifiers, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Methods tab.
    Methods Tab, Modifiers Fields
    DMethods Tab, Modifiers Fields

  4. Complete the Modifiers fields on the Methods tab.

Use the following information to enter data in Modifiers fields on the Methods tab:

Field Description

Access Modifiers

Specify how the method can be accessed:

  • Public iconPublic
  • Protected iconProtected – only visible within its own package and subclasses.
  • Private iconPrivate – not visible for subclasses.
  • Default iconDefault – only visible within its own package.

Other Modifiers

Specify whether the method is Abstract, Final, Synchronized, Static, or Native.

Note: Selecting some modifiers may disable others.


Configuring Method Return Type

This section includes information on using the workbench to configure method return type.


Using Workbench

To specify method return type, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Methods tab.
    Methods Tab, Return Type Fields
    Methods Tab, Return Type Fields

  4. Complete the Return Type fields on the Methods tab.


Use the following information to enter data in Return Type fields on the Methods tab:

Field Description
Type Click Browse and select a class and package for the method.
Dimensionality Specify the length of an array. This field applies only if Type is an array.

Configuring Method Parameters

This section includes information on using the workbench to configure method parameters.


Using Workbench

To specify additional method parameters, use this procedure:

  1. Select a class in the Navigator. Its properties appear in the Editor.
  2. Click the Class Info tab in the Editor.
  3. Click the Methods tab.
    Methods Tab, Method Parameters Fields
    Methods Tab, Method Parameters Fields

  4. Complete the Parameters fields on the Methods tab.


Use the following information to enter data in Parameters fields on the Methods tab:

Field Description
Type Click Browse and select a class and package for the method.
Dimensionality Specify the length of an array. This field applies only if Type is an array.

How to Import and Update Classes

This section includes information on Importing and Updating Classes Using Workbench to import and update Java classes.

You can import Java classes and interfaces created in any IDE.


Note: You can import interfaces only in relational projects.


You can import any class on the system classpath or project classpath.

If a class exists on both the system classpath and the project classpath, Workbench will update the class from the system classpath. To update or refresh from the project classpath, remove the class from the system classpath and restart Workbench.

For more information, see Configuring Project Classpath.


Importing and Updating Classes Using Workbench

Use this procedure to update or refresh the classes in the Workbench project.

  1. Define the available classes and packages for the project on the General tab. See Configuring Project Classpath for information on classes and packages.
  2. Click Add or Refresh Class Add or Refresh Class button. The Select Classes dialog box appears.
    You can also update the classes by choosing Selected > Add or Refresh Classes from the menu.
    Select Classes Dialog Box
    Select Classes Dialog Box

Select the packages or classes (or both) to import into the project and click OK. Workbench adds the new classes to your project in the Navigator.

By default, Workbench creates the following descriptor types for each package and class (depending on your project type):

See Creating a Descriptor for more information.


Note: If the class exists on both the system classpath and the project classpath, Workbench will update the class from the system classpath. To update or refresh from the project classpath, remove the class from the system classpath and restart Workbench.


To Remove a Class from a Project, do the following:

Select the descriptor and click Remove Remove Class button, or choose Selected > Remove from the menu.


How to Manage Nondescriptor Classes

Some of the mappings in your EclipseLink project may reference classes that do not have EclipseLink descriptors or are not included in the project.

To add, remove, or refresh Java classes that do not have EclipseLink descriptors, use this procedure:

From the menu, select Workbench > Manage Non-Descriptor Classes. The Manage Non-Descriptor Classes dialog box appears.

You can access the dialog box by right-clicking the EclipseLink project icon in the Navigator and selecting Manage Non-Descriptor Classes from the context menu.


Manage Non-Descriptor Classes Dialog Box

Manage Non-Descriptor Classes Dialog Box

Select one of the following options:

  • To add new classes, click Add. The Select Classes dialog box appears (see the Select Classes Dialog Box).
    Only classes that have been added to the project's classpath can be added as nondescriptor classes.
  • To delete an existing class, select the class and click Remove.
  • To refresh the classes (for example, if you edited the classes in an IDE), click Refresh.

How to Rename Packages

When you add classes to a project, Workbench shows the classes contained in the package to which they belong (see How to Use the Navigator).

You can use Workbench to change the package statements in all the Java classes of a selected package (to move the all the classes contained by the selected package to a new package). This is useful if you are refactoring an existing Workbench project.


Note: The Workbench package rename feature is not intended for migrating projects to this release of EclipseLink: for this, you must still use the EclipseLink Package Renamer. The Package Renamer updates import statements for EclipseLink classes – it does not change the package statements in user application classes.

For information on the EclipseLink Package Renamer, see "Running the Package Renamer" in the Migration Guide.


For more information on using Workbench to edit classes, see How to Configure Classes.


Renaming Packages Using Workbench

To change the package of an existing class in Workbench, use this procedure:

  1. Right-click the package in the Navigator and select Rename.
    You can also select the package and choose Selected > Rename from the menu.
    Rename Package Dialog Box
    Rename Package Dialog Box

  2. Enter the package name on the Rename Package dialog box and click OK. Workbench will change the name of the package in the Navigator.

Enter the package name and click OK. Workbench changes the name of the package in the Navigator window.

For more information on using Workbench to edit classes, see How to Configure Classes.


Integrating Workbench with Apache Ant

If you use the Apache Ant Java-based build tool, you can use the Ant task and type definitions that EclipseLink provides to invoke certain Workbench functions from an Ant build file. Using these tasks, you can integrate Workbench into your automated build process.

This section describes the following:

For more information about Ant, see http://ant.apache.org/manual/.


How to Configure Ant to Use Workbench Tasks

Before you can use Workbench tasks in your Ant build files, you must consider their library dependencies (see Creating Library Dependencies).

To declare Workbench tasks in your Ant build.xml file, declare them directly (see Declaring Workbench Tasks).


Creating Library Dependencies

In addition to the Ant library dependencies (see http://ant.apache.org/manual/installl#librarydependencies), the following table lists the EclipseLink-specific JAR files that must be in your Ant classpath.


Workbench Ant Task Library Dependencies

JAR Name Needed For... Available At...

eclipselinkmw.jar

Workbench Ant task and type definitions.

<ECLIPSELINK_HOME>/utils/workbench/jlib

Declaring Workbench Tasks

After you declare the Workbench task definitions (see the Workbench Ant Type Definitions) table and data definitions (see the Workbench Ant Task Library Dependencies) table in the eclipselink-ant-lib.xml file (see Declaring Workbench Ant Task and Data Types in an eclipselink-ant-lib.xml File) example, you can use a Workbench task in a build.xml file, as the Specifying the eclipselink-ant-lib.xml File in the build.xml File example shows:

Declaring Workbench Ant Task and Data Types in an eclipselink-ant-lib.xml File

<?xml version="1.0"?>
<antlib>
    <taskdef name="mappings.export"
        classname="org.eclipse.persistence.tools.workbench.ant.taskdefs.ExportDeploymentXMLTask" />

    <taskdef name="mappings.validate"
        classname="org.eclipse.persistence.tools.workbench.ant.taskdefs.MappingsValidateTask" />

    <taskdef name="session.validate"
        classname="org.eclipse.persistence.tools.workbench.ant.taskdefs.SessionValidateTask" />

 
    <typedef name="ignoreerror"
        classname="org.eclipse.persistence.tools.workbench.ant.typedefs.IgnoreError" />

    <typedef name="ignoreerrorset"
        classname="org.eclipse.persistence.tools.workbench.ant.typedefs.IgnoreErrorSet" />

    <typedef name="loginspec"
        classname="org.eclipse.persistence.tools.workbench.ant.typedefs.LoginSpec" />
</antlib>


Specifying the eclipselink-ant-lib.xml File in the build.xml File

<project name="MyBuild" default="validate.session" basedir="." xmlns:eclipselink="eclipselinklib">
   <typedef file = "eclipselink-ant-lib.xml" classpathref = "mw.classpath" uri = "eclipselinklib" />
   ...
</project>


What You May Need to Know About Workbench Ant Task API

The following lists the Workbench Ant task definitions that EclipseLink provides.


Workbench Ant Task Definitions

Task Name EclipseLink Class

mappings.validate Task

org.eclipse.persistence.tools.workbench.ant.taskdefs.MappingsValidateTask

session.validate Task

org.eclipse.persistence.tools.workbench.ant.taskdefs.SessionValidateTask

mappings.export Task

org.eclipse.persistence.tools.workbench.ant.taskdefs.ExportDeploymentXMLTask


The following lists the Workbench Ant type definitions that EclipseLink provides.


Workbench Ant Type Definitions

Type Name EclipseLink Class

ignoreerror Task

org.eclipse.persistence.tools.workbench.ant.typedefs.IgnoreError

ignoreerrorset Task

org.eclipse.persistence.tools.workbench.ant.typedefs.IgnoreErrorSet

loginspec Task

org.eclipse.persistence.tools.workbench.ant.typedefs.LoginSpec


How to Create Workbench Ant Tasks

The following shows a typical Ant build.xml file that declares and uses the Workbench Ant task and type definitions.


Example Ant Build File with Workbench Ant Tasks

<project name="MyBuild" default="validate.session" basedir="." xmlns:eclipselink="eclipselinklib">
    <! –  =====================================================  – >
    <! –   Properties                                            – >

    <! –  =====================================================  – >
    <target name="init">
        <property file="build.properties"/>

        <property name = "eclipselink.mwp.dir" value = "${basedir}/mw"/>
        <property name = "eclipselink.sessions.dir" value = "${basedir}/config"/>
        <property name = " myProject.classes" value = "${basedir}/classes "/>

        <path id = "database.classpath">
            <pathelement path = "${eclipselink.home}/jlib/dms.jar"/>
            <pathelement path = "${eclipselink.home}/jlib/OracleThinJDBC.jar"/>
        </path>
        <path id = "eclipselink.classpath">
            <pathelement path = "${eclipselink.home}/jlib/eclipselink.jar"/>
            <pathelement path = "${eclipselink.home}/lib/shared/11.1.1.0.0/antlr.jar"/>
        </path>
        <path id = "mw.classpath">
            <pathelement path = "${eclipselink.home}/utils/workbench/jlib/elmwcore.jar"/>

            <pathelement path = "${eclipselink.home}/utils/workbench/jlib/eclipselinkmw.jar"/>
        </path>
        <path id = "mwplatforms.classpath">
            <pathelement path = "${eclipselink.home}/utils/workbench/config"/>
        </path>

        <typedef file = "eclipselink-ant-lib.xml"

                 classpathref = "mw.classpath"
                 uri = "eclipselinklib" />

    </target>
    <! –  =====================================================  – >
    <! –   Define task parameter                                 – >
    <! –  =====================================================  – >
    <target name="parameter.definition" depends="init">
        <eclipselink:ignoreerrorset id = "ignoreErrors">

        <eclipselink:ignoreerror code = "0233" />
        </eclipselink:ignoreerrorset>

        <eclipselink:loginspec id = "loginSpec" 
        url = "jdbc:cloudscape:stagedb;create=true"
        driverclass = "COM.cloudscape.core.JDBCDriver"
        user = "scott" 
        password="tiger" />
    </target>
    <! –  ====================================================  – >
    <! –   Validate the MW Project                               – >

    <! –  =====================================================  – >
    <target name="validate.project" depends="parameter.definition">

        <eclipselnk:mappings.validate
            projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
            reportfile = "${eclipselink.mwp.dir}/problem-reportl"
            reportformat = l"
            property = "mw-valid"
            classpathref = "mwplatforms.classpath" >

            <eclipselink:classpath refid = "mw.classpath" />
            <eclipselink:classpath refid = "eclipselink.classpath" />

            <eclipselink:ignoreerrorset refid = "ignoreErrors"/>

        </eclipselink:mappings.validate>
    </target>
    <! –  =====================================================  – >
    <! –   EclipseLink deployment descriptor XML generation          – >

    <! –  =====================================================  – >
    <target name="export.deployment" depends="validate.project"  if="mw-valid">

        <eclipselink:mappings.export 
            projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
            deploymentfile = "${eclipselink.sessions.dir}/sessions.xml"
            property = "export-completed"
            failonerror = "true"
            classpathref = "eclipselink.classpath">

            <eclipselink:classpath refid = "mw.classpath" />
            <eclipselink:classpath refid = "mwplatforms.classpath" />

            <eclipselink:ignoreerrorset refid = "ignoreErrors"/>
            <eclipselink:loginspec refid = "loginSpec" />
        </eclipselink:mappings.export>
    </target>
    <! –  =====================================================  – >
    <! –   EclipseLink Session Validate                              – >

    <! –  =====================================================  – >
    <target name="validate.session"  depends="export.deployment" if="export-completed">

        <eclipselink:session.validate
            sessionsfile = "${eclipselink.sessions.dir}/sessions.xml"
            sessionname = "ThreeTierEmployee"
            property = "session-valid"
            classpathref = "eclipselink.classpath"
            classpath = "${ myProject.classes}" >

            <eclipselink:classpath refid = "mw.classpath" />
            <eclipselink:classpath refid = " database.classpath" />

            <eclipselink:loginspec refid = "loginSpec" />
        </eclipselink:session.validate>
    </target>
<project>

How to Create the mappings.validate Task

The mapings.validate task is a testing task that you use to list of all the problems in a Workbench project (.mwp) file.

This task lets you do the following:

  • log all the problems to a file in text orL format;
  • set an Ant property to indicate that the Workbench project is valid (has no errors).


Using Parameters

mappings.validate Task Parameters

Attribute Description Required

projectfile

Fully qualified Workbench projects file name (.mwp).

Yes

reportfile

Fully qualified file name to which to write the output.

No

reportformat

The format of the generated output. Must be codel or text.

No – default to text.

classpath

Project classpath.

No

classpathref

Reference to a path defined elsewhere.

No

property

The name of the property to set (true if there is no problem).

No


Specifying Parameters Specified as Nested Elements

You can specify the following parameters as nested elements of this task:


Examples

The following shows a typical mappings.validate task.


A mappings.validate Task

<eclipselink:mappings.validate
    projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
    reportfile = "${eclipselink.mwp.dir}/problem-reportl"
    reportformat = l"
    property = "mw-valid"
    classpath = "${mwplatforms.classpath}" >

    <eclipselink:classpath refid = "mw.classpath" />
    <eclipselink:classpath refid = "eclipselink.classpath" />

    <eclipselink:ignoreerrorset refid = "ignoreErrors"/>
    <eclipselink:ignoreerror code = "0555" />

</eclipselink:mappings.validate>


How to Create the session.validate Task

The session.validate task is a testing task that you use to test your EclipseLink deployment XML by running EclipseLink.

This task provides the ability to do the following:

  • specify the test type using a nested element;
  • set an Ant property to indicate that the Workbench project is valid (has no errors).


Using Parameters

session.validate Task Parameters

Attribute Description Required

sessionsfile

Fully qualified sessions.xml file.

No – default to sessions.xml and to classpath.

sessionname

Name of the session to test.

Yes

classpath

Project classpath.

No

classpathref

Reference to a path defined elsewhere.

No

property

The name of the property to set (true if valid).

No


Specifying Parameters Specified as Nested Elements

You can specify the following parameters as nested elements of this task:


Examples

The following shows a typical session.validate task.


A session.validate Task

<eclipselink:session.validate      
    sessionsfile = "${eclipselink.sessions.dir}/sessions.xml"
    sessionname = "ThreeTierEmployee"
    property = "session-valid"
    classpathref = "eclipselink.classpath"
    classpath = "${ myProject.classes}" >

    <eclipselink:classpath refid = "mw.classpath" />
    <eclipselink:classpath refid = " database.classpath" />

    <eclipselink:loginspec refid = "loginSpec" />

</eclipselink:session.validate>


How to Create the mappings.export Task

The mappings.export task is a generation task that you use to generate an EclipseLink deployment XML file for a given Workbench project (.mwp). The mappings.export task executes a Hmappings.validate task before executing. A BuildException is thrown if validation fails.

This task provides the ability to override the Workbench project database login information.


Using Parameters

mappings.export Task Parameters

Attribute Description Required

projectfile

Fully qualified Workbench projects file name (.mwp).

Yes

deploymentfile

Fully qualified EclipseLink project deployment file name (.xml).

No – default to the name specified in the Workbench project (.mwp).

ejbjarxmldir

The directory that contains the ejb-jar.xml file (only applicable to Java EE project).

No – default to the directory specified in the Workbench project (.mwp).

classpath

Project classpath.

No

classpathref

Reference to a path defined elsewhere.

No

failonerror

Indicates whether the build will continue even if there are export errors; defaults to true.

No

property

The name of the property to set (true if export completed successfully).

No


Specifying Parameters Specified as Nested Elements

You can specify the following parameters as nested elements of this task:


Examples

The following example shows a typical mappings.export task.


A mappings.export Task

<eclipselink:mappings.export 
    projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
    deploymentfile = "${eclipselink.sessions.dir}/sessions.xml"
    property = "export-completed"
    failonerror = "true"
    classpathref = "eclipselink.classpath">

    <eclipselink:classpath refid = "mw.classpath" />

    <eclipselink:classpath refid = "mwplatforms.classpath" />

    <eclipselink:ignoreerrorset refid = "ignoreErrors"/>
    <eclipselink:ignoreerror code = "0545" />
    <eclipselink:loginspec
            url = "jdbc:cloudscape:stagedb;create=true"
            driverclass = "COM.cloudscape.core.JDBCDriver"
            user = "scott" 
            password="tiger" />
</eclipselink:mappings.export>


How to Create the classpath Task

Use the classpath element to define the Java classpath necessary to run a task. For more information, see http://ant.apache.org/manual/usingl#path.


Using Parameters

classpath Element Parameters

Attribute Description Required

location

Specifies a single file or directory relative to the project's base directory (or an absolute filename).

No

path

Specifies one or multiple files or directories separated by a colon or semicolon.

No

refid

Reference to a path defined elsewhere.

No


Specifying Parameters Specified as Nested Elements

You can specify the following parameters as nested elements of this task:

  • pathelement
  • fileset
  • dirset
  • filelist


Examples

The following example shows a typical classpath element.

A classpath Element

<classpath>
   <pathelement path="${classpath}"/>
       <fileset dir="lib">
           <include name="**/*.jar"/>
       </fileset>
   <pathelement location="classes"/>
       <dirset dir="${build.dir}">
           <include name="apps/**/classes"/>
           <exclude name="apps/**/*Test*"/>
       </dirset>
   <filelist refid="third-party_jars"/>
</classpath>


How to Create the ignoreerror Task

Use the ignoreerror element to instruct an EclipseLink Ant task to ignore a specific EclipseLink Foundation Library or Workbench (see Troubleshooting an EclipseLink Application (ELUG)) run-time error code.

To instruct an EclipseLink Ant task to ignore multiple error codes, consider using an ignoreerrorset element.


Using Parameters

ignoreerror Element Parameters

Attribute Description Required

code

Error code of the problem to ignore.

Yes


Specifying Parameters Specified as Nested Elements

You cannot specify parameters as nested elements of this element.


Examples

The following example shows a typical ignoreerror element. This element instructs a mappings.export task to ignore Workbench error code 0545.

An ignoreerror Element

<eclipselink:mappings.export
    projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
   deploymentfile = "${eclipselink.sessions.dir}/sessions.xml"
   classpathref = "eclipselink.classpath">
   <eclipselink:classpath refid = "mw.classpath" />
   <eclipselink:classpath refid = "mwplatforms.classpath" />
   <eclipselink:ignoreerror code = "0545" />
</eclipselink:mappings.export>


How to Create the ignoreerrorset Task

Use the ignoreerrorset element to instruct an EclipseLink Ant task to ignore any of multiple EclipseLink Foundation Library or Workbench run-time error codes.


Using Parameters

ignoreerrorset Element Parameters

Attribute Description Required

id

Unique identifier for this type instance, can be used to reference this type in scripts.

No

refid

Reference to a ignoreerrorset defined elsewhere.

No


Specifying Parameters Specified as Nested Elements

You can specify the following parameter as nested elements of this element:


Examples

The following example shows a typical ignoreerrorset element. This element instructs a mappings.export task to ignore all of Workbench error codes 0402 and 0570. Note that the mappings.export task also uses an explicitly ignoreerror element: this means that the mappings.export task will ignore all of error codes 0402, 0570, and 0545.

An ignoreerrorset Element

<eclipselink:ignoreerrorset id = "ignoreErrors">
   <eclipselink:ignoreerror code = "0402" />
   <eclipselink:ignoreerror code = "0570" /></eclipselink:ignoreerrorset>
   ...
   <eclipselink:mappings.export
    projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
    deploymentfile = "${eclipselink.sessions.dir}/sessions.xml"
    classpathref = "eclipselink.classpath">
   <eclipselink:classpath refid = "mw.classpath" />
   <eclipselink:classpath refid = "mwplatforms.classpath" />
   <eclipselink:ignoreerrorset refid = "ignoreErrors"/>
   <eclipselink:ignoreerror code = "0545" />
</eclipselink:mappings.export>

How to Create the loginspec Task

Use the loginspec element to instruct an EclipseLink Ant task to override the project database login information in a Workbench project. For more information, see Introduction to Data Access.


Note: You can only use this element with Relational Projects. You cannot use this element with a Java EE project.


Using Parameters

loginspec Element Parameters

Attribute Description Required

id

Unique identifier for this type instance, can be used to reference this type in scripts.

No

refid

Reference to a loginspec defined elsewhere.

No

driverclass

Fully qualified class of the data source driver (see Configuring Database Login Connection Options).

No – default to the class that the Workbench project specifies.

url

URL of the driver (see Configuring Database Login Connection Options).

Yes

user

Login user name (see Configuring User Name and Password).

No – default to the value that the Workbench project specifies

password

Login password (see Configuring User Name and Password).

No – default to the value that the Workbench project specifies


Specifying Parameters Specified as Nested Elements

You cannot specify parameters as nested elements of this element.


Examples

The following example shows a typical loginspec element.

A loginspec Element

<eclipselink:mappings.export 
    projectfile = "${eclipselink.mwp.dir}/myProject.mwp"
    deploymentfile = "${eclipselink.sessions.dir}/sessions.xml"
    classpathref = "eclipselink.classpath">

    <eclipselink:classpath refid = "mw.classpath" />
    <eclipselink:classpath refid = "mwplatforms.classpath" />

    <eclipselink:loginspec
        url = "jdbc:cloudscape:stagedb;create=true"
        driverclass = "COM.cloudscape.core.JDBCDriver"
        user = "scott" 
        password="tiger" />

</eclipselink:mappings.export>



Copyright Statement

Copyright © Eclipse Foundation, Inc. All Rights Reserved.