Naming Convention
Generated Java class names, method names, fields, and parameter names are derived from the corresponding PL/SQL names (functions, procedures, packages, object types, and parameters) and converted to camelCase / PascalCase as appropriate.
Example: Transfer Object
Object Type Specification :
COL_OBJECT
/**
* Object type with three fields of date, timestamp and varchar2.
*/
create or replace type col_object force as object (
d date,
ts timestamp,
s varchar2(100)
);
- The PL/SQL object type COL_OBJECT is mapped to the Java transfer object ColObject.
- The Java transfer object ColObject contains the following fields:
- java.sql.Date d;
- java.sql.Timestamp ts;
- java.lang.String s;
Example: Collection
Collection Table Type :
TABLE_OF_COL_OBJECT
/**
* Table of type col_object.
*/
create or replace type table_of_col_object as table of col_object;
- The PL/SQL collection TABLE_OF_COL_OBJECT (of object type COL_OBJECT) is mapped to List<ColObject> in Java.
Example: PL/SQL Procedure
PL/SQL Procedure :
COLLECTIONS_OF_OBJECTS
create or replace procedure collections_of_objects
(
i_delta_d in number,
i_delta_ts in number,
i_col_objects in table_of_col_object,
o_col_objects out table_of_col_object
)
/**
* Demonstration of calling a stored procedure with input of table of object elements. The elements are modified and returned as out put parameter.
*
* @param i_delta_d Offset is added to date value.
* @param i_delta_ts Offset is added to timestamp value.
* @param i_col_objects Input list of collection objects.
* @param o_col_objects Output list of collection objects.
*/
is
begin
-- initialize output collection
o_col_objects := table_of_col_object();
-- append elements to collection
for i in 1..i_col_objects.count loop
o_col_objects.extend();
o_col_objects(i) := col_object(i_col_objects(i).d + i_delta_d + i, i_col_objects(i).ts + i_delta_ts + i, i_col_objects(i).s || ' - ' || DBMS_RANDOM.string('A',10));
end loop;
end collections_of_objects;
- The PL/SQL procedure COLLECTIONS_OF_OBJECTS is represented in Java as:
- Implementation class: CollectionsOfObjectsServiceImpl
- Service interface: CollectionsOfObjectsService
- Factory getter method: getCollectionsOfObjectsService()
- Parameter: i_delta_d => Integer iDeltaD (numeric conversion model: int/Integer)
- Parameter: i_delta_ts => java.sql.Timestamp iDeltaTs
- Parameter: i_col_objects => List<ColObject> iColObjects
- OUT value: o_col_objects => Java return value List<ColObject>