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;}
| Java Programming with Oracle SQLJ | | | Copyright | | | Table of Contents | | | Preface | | | 1. Introduction | | | 2. Relational Databases, SQL, and PL/SQL | | | 3. Fundamental SQLJ Programming | | | 4. Database Objects | | | 5. 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 | | | 6. Deploying SQLJ in the JServer | | | 7. Large Objects | | | 8. Contexts and Multithreading | | | 9. Advanced Transaction Control | | | 10. Performance Tuning | | | 11. Combining JDBC, SQLJ, and Dynamic SQL | | | A. Java and Oracle Type Mappings | | | B. Oracle Java Utilities Reference | | | C. SQLJ in Applets, Servlets, and JavaServer Pages | | | Colophon | | | Index | | | Database > Java Programming with Oracle SQLJ > 5. Collections > 5.4 Collection Custom Classes | 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. |
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 | |