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.
Difference between revisions of "EclipseLink/Development/DBWS/AdvancedJDBCTypesThruJPub"
(→DBWS utility enhancement: support for Advanced JDBC types thru JPub) |
|||
Line 50: | Line 50: | ||
is difficult and not standard across different database platforms. For support on Oracle, the JPub-derived <code>SqlReflector</code> is used | is difficult and not standard across different database platforms. For support on Oracle, the JPub-derived <code>SqlReflector</code> is used | ||
to extract the database metadata. | to extract the database metadata. | ||
+ | |||
+ | === Publisher Walker/Listener === | ||
+ | The database metadata returned by <code>SqlReflector</code> is a series of nested objects, starting with a <code>SqlTypeWithMethods</code> to represent the Stored Procedure (function) and <code>SqlObjectType</code>'s + <code>SqlArrayType</code>'s to represent the Advanced JDBC types | ||
+ | shown above. | ||
+ | |||
+ | Once these objects are returned by the <code>SqlReflector</code>, a <code>o.e.p.platform.database.oracle.publisher.visit.PublisherWalker</code> is | ||
+ | built to traverse the graph of <code>Sqlnnn</code> objects. The walker will throw 'events' that a custom <code>o.e.p.platform.database.oracle.publisher.visit.PublisherListener</code> can capture and in doing so, build the necessary EclipseLink artifacts | ||
+ | required to support invoking the Stored Procedure (i.e. <code>o.e.p.mappings.structures.StructureMapping</code> for the ORM project; <code>o.e.p.oxm.mappings.XMLCompositeObjectMapping</code> for the OXM project) |
Revision as of 14:15, 16 April 2009
DBWS Schema Naming Convention Transformers
Document History
Date | Author | Version Description & Notes |
---|---|---|
090416 | Mike Norman | 1.0 |
DBWS utility enhancement: support for Advanced JDBC types thru JPub
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)