Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Development/DBWS/AdvancedJDBCTypesThruJPub"

Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
== DBWS Schema Naming Convention Transformers ==
+
== DBWS Support for Advanced JDBC types ==
  
 
== Document History ==
 
== Document History ==

Revision as of 14:15, 16 April 2009

DBWS Support for Advanced JDBC types

Document History

Date Author Version Description & Notes
090416 Mike Norman 1.0

DBWS utility enhancement: support for Advanced JDBC types thru JPub

271679

Similar to the work supporting advanced PL/SQL types (records, collections), DBWSBuilder should use o.e.p.platform.database.oracle.publisher.sqlrefl.SqlReflector to extract the database metadata for Stored Procedures that use Advanced JDBC types:

-- a series of nested types
CREATE TYPE Region AS OBJECT (
 reg_id       NUMBER(5),
 reg_name     varchar2(50)
);
CREATE TYPE Emp_Address AS OBJECT (
 street       varchar2(100),
 suburb       varchar2(50),
 postcode     INTEGER,
 addr_region  REGION
);
CREATE TYPE Emp_Object AS OBJECT (
 employee_id   NUMBER(8),
 employee_name VARCHAR2(80),
 date_of_hire  DATE,
 address       emp_address
);
-- a Stored Procedure (function) that uses 'root' of nested types
package advanced_object_demo AS
    FUNCTION echoEmployee (pEmployee IN Emp_Object)
      RETURN Emp_Object;
END advanced_object_demo;

Extracting the database metadata for the above artifacts via the JDBC metadata API java.sql.DatabaseMetaData is difficult and not standard across different database platforms. For support on Oracle, the JPub-derived SqlReflector is used to extract the database metadata.

Publisher Walker/Listener

The database metadata returned by SqlReflector is a series of nested objects, starting with a SqlTypeWithMethods to represent the Stored Procedure (function) and SqlObjectType's + SqlArrayType's to represent the Advanced JDBC types shown above.

Once these objects are returned by the SqlReflector, a o.e.p.platform.database.oracle.publisher.visit.PublisherWalker is built to traverse the graph of Sqlnnn objects. The walker will throw 'events' that a custom o.e.p.platform.database.oracle.publisher.visit.PublisherListener can capture and in doing so, build the necessary EclipseLink artifacts required to support invoking the Stored Procedure (i.e. o.e.p.mappings.structures.StructureMapping for the ORM project; o.e.p.oxm.mappings.XMLCompositeObjectMapping for the OXM project)

Back to the top