When you generate an implementation of an interface, you
can use an XML file to override the SQL annotations in that interface.
The XML file can also override the definition of the corresponding
bean. The workbench can generate the XML file for you and you can
edit it.
About this task
To generate an implementation of an interface, the workbench
invokes the pureQuery Generator. The pureQuery Generator allows you
to supply an XML file in which you can override the SQL statements
that are in the annotations of the methods that the interface declares.
The
types, elements, and attributes that the pureQuery Generator recognizes
when examining XML configuration files are a subset of the formal Java™ Persistence API (JPA) specification.
There
is only one XML configuration file per project. After you create an
XML file in a project, all subsequent overrides that you create for
interfaces or beans within that project are appended to the file.
Procedure
To regenerate implementation classes with the help of
an XML configuration file:
- Optional: Specify the name of and path for
the XML configuration file to generate. If you do not follow
this step, the name and path default to <path_to_workspace>\dataAccessFolder\orm.xml.
- Right-click your Java project
and select Properties.
- Select the pureQuery page.
- Under File path for generating pureQuery
XML, type the path and file name, or browse to and select
an existing XML file.
- Follow either or both of these steps to generate an XML
configuration file. If you follow both steps, the workbench appends
XML in the file that you created with the first step that you performed.
- To generate XML that you can edit to override the SQL statements
that are in the annotations that an interface declares:
- Open the interface in the Java editor.
- Right-click anywhere in the interface and select Data
Access Development > Generate XML.
If the XML configuration file does not already exist, the workbench
generates the file in the location that you specified. If the file
already exists, the workbench appends the XML to the content of the
file.
If you right-click in an interface that extends annotated-method
style interfaces, the workbench generates XML metadata for each of
the extended interfaces, as well as for the extending interface if
it declares annotated methods.
- To generate XML that you can edit to override the definition of
the bean that corresponds to the interface, follow these steps:
- Open the bean in the Java editor.
- Right-click anywhere in the bean and select Data Access
Development > Generate XML. If
the XML configuration file does not already exist, the workbench generates
the file in the location that you specified. If the file already exists,
the workbench appends the XML to the content of the file.
- Repeat step two for each implementation class that you
want to regenerate.
- Edit the XML configuration file.
- Delete the interface implementation that you want to regenerate.
- Select Project > Clean and
specify to clean the project. The implementations are regenerated
from the options in the XML file.