The Data Object Design Studio (DODS) lets you
design the data-layer classes of an application that uses the Enhydra Application
Framework. You can then use DODS to generate and compile the Java source code for these
data-layer classes.
Running DODS
To run DODS, simply invoke it in your build.xml like this:
<taskdef name="dods_gen" classname="org.enhydra.dods.taskdefs.DodsGenerator"
classpathref="build.gen.classpath" />
<dods_gen doml="${src.gen.dir}/discRack.doml"
vendor="Standard"
enhydraversion="enhydra3"
jdbcversion="jdbc1"
showdetail="true"
sourceout="${src.gen.dir}"
srcdir="${src.gen.dir}"
destdir="${build.classes.dir}"
includes="**/*.java"
excludes="**/old**/**"
debug="${build.debug}"
optimize="${build.optimize}"
deprecation="${build.deprecation}"
verbose="${build.verbose}"
/>
When you run Ant, this will invoke the DodsGenerator taskdef, which will automatically
invoke DODS to generate the necessary files and then compile them for you too.
What's new in DODS 4.0?
DODS has a new user interface.
DODS converts Enhydra 3 DOML files to the new Enhydra 4 DOML format. When you open an
Enhydra 3 DOML file, the editor saves a back up copy with a .dods3 extension.
Old and new DODS terminology:
DODS3 DOML Term |
DODS3 UI Term |
DODS4 Term |
database |
database |
vendor |
package |
package |
package |
table |
data object |
class |
column |
attribute |
field |
Adding packages
To add packages:
- Select the doml entry, then right-click and choose package from the Add menu or choose
the Insert | package menu command.
- Specify the package name, then choose Apply.
Modifying vendor information
The vendor element specifies the database type used for this DOML. You can choose from
Standard, Instant DB, Oracle, Informix, MSQL, Sybase, and PostgreSQL.
To modify vendor information:
- Double click the vendor entry in the tree, then choose the vendor.
- Choose Apply.
Adding classes
- Select the package, then right-click and choose class from the Add menu or choose the
Insert | class menu command.
- Specify any of the following attributes, then choose Apply.
Attribute |
Description |
name |
The name of the class. |
modifier |
Whether the data object is abstract, final, or neither. Abstract data
objects can be extended by another data object. Final data objects cannot be extended nor
be a subclass. |
extends |
The name of a table of which this table is an extension. |
use-oid |
Specifies whether or not to have an oid for every row. |
lazy-loading |
Whether or not the data object uses lazy loading. |
is-stored-proc |
Whether or not the data object is a stored procedure. |
vendor |
The vendor name. |
caching |
Specifies how the data object is cached: fully, partially, or not at all. |
table |
The table name. |
Adding fields
- Select the class, then right-click and choose field from the Add menu or choose the
Insert | field menu command.
- Specify any of the following attributes, then choose Apply.
Attribute |
Description |
name |
The name of the column. |
constraint |
Whether or not the specified table row must exist. |
sp-param-index |
Stored procedure parameter index. |
foreignkeyfield |
Foreign key field. |
foreignkeygroup |
Foreign key group. |
can-query |
Whether or not the values of the column are used for queries. |
primary-key |
Whether or not the column is a primary key. |
index |
Whether or not the table column has an index. |
sp-param-type |
Stored procedure parameter type. |
constant |
Whether or not the column contains a constant value. |
null-allowed |
Whether or not the column can contain null values. |
database-type |
The internal SQL data type the database uses to store values. |
java-type |
The Java data type returned by the data object to the user. |
size |
The size of the data types that are commonly measured in width. |
Adding Javadoc and default text
- Select the field, then right-click and choose Javadoc or default from the Add menu or
choose the Insert | javadoc or Insert | default menu command.
- Specify text in the text box, then choose Apply.
Generating code
To generate Java source code:
- Choose the File | Generate Java Source command.
- Specify the directory in which to generate the Java source.
- Check the Overwrite checkbox if you want the entire contents of the directory
overwritten with the new Java source code.
- Choose the Database Manager: EAS 4.x/JDBC or Enhydra 3.x.
- If you choose EAS 4.x/JDBC, you can optionally check one of the following settings:
- Use Data Sources: If checked, uses JDBC 2, which uses data sources gotten by JNDI; if
not checked uses JDBC 1, uses connections.
- Generate EJB: If checked, generates EJB code.
- Click Generate.
|