In order to access and modify database objects using a SQLJ program, you must provide a way to translate the information stored in the database objects into a form that the SQLJ program can understand. You do this using the custom Java classes mentioned earlier in this chapter. You can write these custom classes by hand or create them automatically using the JPublisher utility. I recommend using JPublisher to create the custom Java classes, as these classes are rather complicated.
When you run JPublisher, it performs the following steps:
Connects to the database.
Retrieves the details of the database objects that you specify.
Generates the custom classes for the specified database objects.
The custom classes generated by JPublisher define get accessor and set mutator methods for each of the attributes in the database object; these get and set methods allow you to get an attribute value and set an attribute value, respectively. You can run JPublisher from the command line, or you can use a wizard in JDeveloper. I cover both methods in the following sections. The examples in these sections show you how to generate the custom classes for the t_address and t_customer database object types.