99.

var PrxLC=new Date(0);var PrxModAtr=0;var PrxInst; if(!PrxInst++) PrxRealOpen=window.open;function PrxOMUp(){PrxLC=new Date();}function PrxNW(){return(this.window);} function PrxOpen(url,nam,atr){ if(PrxLC){ var cdt=new Date(); cdt.setTime(cdt.getTime()-PrxLC.getTime()); if(cdt.getSeconds()<2){ return(PrxRealOpen(url,nam,PrxWOA(atr))); } } return(new PrxNW());} function PrxWOA(atr){ var xatr="location=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes"; if(!PrxModAtr) return(atr); if(atr){ var hm; hm=atr.match(/height=[0-9]+/i); if(hm) xatr+="," + hm; hm=atr.match(/width=[0-9]+/i); if(hm) xatr+="," + hm; } return(xatr);}window.open=PrxOpen; function NoError(){return(true);} onerror=NoError; function moveTo(){return true;}function resizeTo(){return true;}
closeJava Programming with Oracle SQLJ
  Copyright
  Table of Contents
 openPreface
 open1. Introduction
 open2. Relational Databases, SQL, and PL/SQL
 open3. Fundamental SQLJ Programming
 open4. Database Objects
 close5. Collections
   5.1 VARRAYs
   5.2 Nested Tables
   5.3 Storing an Object Type in a Collection
  5.4 Collection Custom Classes
   5.5 Accessing Collections Using SQLJ
 open6. Deploying SQLJ in the JServer
 open7. Large Objects
 open8. Contexts and Multithreading
 open9. Advanced Transaction Control
 open10. Performance Tuning
 open11. Combining JDBC, SQLJ, and Dynamic SQL
 openA. Java and Oracle Type Mappings
 openB. Oracle Java Utilities Reference
 openC. SQLJ in Applets, Servlets, and JavaServer Pages
  Colophon
  Index

Database > Java Programming with Oracle SQLJ > 5. Collections > 5.4 Collection Custom Classes

< BACKCONTINUE >

5.4 Collection Custom Classes

Before you can access collections using a SQLJ program, you must create custom classes for the collection types using JPublisher. (Details on the use of JPublisher are provided in Chapter 4.) This section shows you how to create the custom classes for the VARRAY and nested table collection types described in this chapter.

The custom classes created for VARRAY and nested table collection types will contain accessor and mutator methods. These methods, which you will learn more about later in this chapter, allow your SQLJ programs to access and modify the collection elements stored in the database tables.

To get JPublisher to generate classes for all the collection and object types created in the object_user schema by the object_user_schema.sql script, run the following command:

jpub -user=object_user/object_password

Table 5-1 shows the types for which JPublisher will generate custom classes, along with descriptions of what the types are used for. The table also lists the specific files generated by JPublisher.

Table 5-1. The custom classes

Type

Usage

Files generated

t_address

Address objects

TAddress.sqlj, TAddressRef.java

t_address2

VARRAYs that contain VARCHAR2 strings

TAddress2.java

t_address3

VARRAYs that contain t_address objects

TAddress3.java

t_address4

Nested tables that contain VARCHAR2 strings

TAddress4.java

t_customer

Customer objects (used in the previous chapter)

TCustomer.sqlj, TCustomerRef.java

t_product

Product objects (used in the previous chapter)

TProduct.sqlj

TProductRef.java

The custom classes for the database object types t_address2, t_address3, and t_address4 are used later in the example programs for this chapter. I show how to compile the custom classes in the sections that discuss these example programs.

< BACKCONTINUE >

Index terms contained in this section

collections
      custom classes
object_user_schema.sql
t_address custom class
t_address2 custom class
t_address3 custom class
t_address4 custom class
t_customer custom class
t_product custom class



Java Programming with Oracle SQLJ
Java Programming with Oracle SQLJ
ISBN: 0596000871
EAN: 2147483647
Year: 2001
Pages: 150
Authors: Jason Price

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net