Oracle8i JDBC Developer's Guide and Reference
Release 3 (8.1.7)

Part Number A83724-01

Library

Product

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

Custom Collection Classes with JPublisher

This chapter primarily describes the functionality of the oracle.sql.ARRAY class, but it is also possible to access Oracle collections through custom Java classes or, more specifically, custom collection classes.

You can create custom collection classes yourself, but the most convenient way is to use the Oracle JPublisher utility. Custom collection classes generated by JPublisher offer all the functionality described earlier in this chapter, as well as the following advantages (it is also possible to implement such functionality yourself):

A custom collection class must satisfy three requirements:

A JPublisher-generated custom collection class implements CustomDatum and CustomDatumFactory and indirectly includes an oracle.sql.ARRAY attribute. The custom collection class will have an oracle.jpub.runtime.MutableArray attribute. The MutableArray class has an oracle.sql.ARRAY attribute.


Note:

When you use JPublisher to create a custom collection class, you must use the CustomDatum implementation. This will be true if JPublisher's -usertypes mapping option is set to oracle, which is the default.

You cannot use a SQLData implementation for a custom collection class (that implementation is for custom object classes only). Setting the -usertypes mapping option to jdbc is invalid.  


As an example of custom collection classes being strongly typed, if you define an Oracle collection MYVARRAY, then JPublisher can generate a MyVarray custom collection class. Using MyVarray instances, instead of generic oracle.sql.ARRAY instances, makes it easier to catch errors during compilation instead of at runtime--for example, if you accidentally assign some other kind of array into a MyVarray variable.

If you do not use custom collection classes, then you would use standard java.sql.Array instances (or oracle.sql.ARRAY instances) to map to your collections.

For more information about JPublisher, see "Using JPublisher to Create Custom Object Classes", or refer to the Oracle8i JPublisher User's Guide.



Go to previous page
Go to beginning of chapter
Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index