Jump to: navigation, search

Difference between revisions of "EclipseLink/FAQ/DBWS"

(Oracle PL/SQL Records and Collections)
(Oracle PL/SQL Records and Collections)
Line 29: Line 29:
 
Given the following PL/SQL Package:
 
Given the following PL/SQL Package:
 
<source lang="plsql" enclose="div">
 
<source lang="plsql" enclose="div">
  CREATE OR REPLACE PACKAGE MYPKG AS
+
CREATE OR REPLACE PACKAGE MYPKG AS
    TYPE TBL1 IS TABLE OF VARCHAR2(111) INDEX BY BINARY_INTEGER;
+
  TYPE TBL1 IS TABLE OF VARCHAR2(111) INDEX BY BINARY_INTEGER;
    TYPE ARECORD IS RECORD (
+
  TYPE ARECORD IS RECORD (
      T1 TBL1,
+
    T1 TBL1,
      T2 BOOLEAN
+
    T2 BOOLEAN
  );
+
  );
    FUNCTION F1(FOO IN VARCHAR2) RETURN ARECORD;
+
  FUNCTION F1(FOO IN VARCHAR2) RETURN ARECORD;
  END MYPKG;
+
END MYPKG;
 
</source>
 
</source>
  
 
The following equivalent JDBC types are required:
 
The following equivalent JDBC types are required:
 
<source lang="plsql" enclose="div">
 
<source lang="plsql" enclose="div">
  CREATE OR REPLACE TYPE MYPKG_TBL1 AS TABLE OF VARCHAR2(111)
+
CREATE OR REPLACE TYPE MYPKG_TBL1 AS TABLE OF VARCHAR2(111)
  
  CREATE OR REPLACE TYPE MYPKG_ARECORD AS OBJECT (
+
CREATE OR REPLACE TYPE MYPKG_ARECORD AS OBJECT (
    T1 MYPKG_TBL1,
+
  T1 MYPKG_TBL1,
    T2 BOOLEAN
+
  T2 BOOLEAN
  )
+
)
 
</source>
 
</source>
 
  
 
[[Category:EclipseLink FAQ|DBWS]]
 
[[Category:EclipseLink FAQ|DBWS]]

Revision as of 13:30, 25 July 2012

What is EclipseLink DBWS?

Overview

For the current version, see: Developing Persistence Architectures Using EclipseLink Database Web Services, Release 2.4

For EclispeLink DBWS Overview, see http://www.eclipse.org/eclipselink/documentation/2.4/dbws/overview.htm

Who uses this feature?

Anyone who wishes to expose a database artifact as a Web Service.

Why do they use it?

EclipseLink DBWS provides a simple light-weight metadata model that requires no Java programming, yet is highly extensible.

What technologies apply?

EclipseLink JPA/ORM, MOXy, JAX-WS

What version of JavaSE does DBWS support?

Using the EclipseLink DBWS design-time tools requires JDK 1.6 (or higher) while the DBWS runtime requires JDK 1.5 or higher.

Oracle PL/SQL Records and Collections

Oracle PL/SQL Record and Collection types cannot be transported over JDBC. To compensate for this, an anonymous block of PL/SQL code will be generated that contains functions responsible for converting to/from equivalent JDBC and PL/SQL types, based on the information passed to the DBWS Builder. In order for this to work, each PL/SQL record or collection type that will be an IN, IN OUT, OUT or RETURN argument (or any PL/SQL record/collection type nested within these) will need to have an equivalent JDBC type - the name of the type is expected to be in the form <package name>_<type name>.

Given the following PL/SQL Package:

CREATE OR REPLACE PACKAGE MYPKG AS
  TYPE TBL1 IS TABLE OF VARCHAR2(111) INDEX BY BINARY_INTEGER;
  TYPE ARECORD IS RECORD (
    T1 TBL1,
    T2 BOOLEAN
  );
  FUNCTION F1(FOO IN VARCHAR2) RETURN ARECORD;
END MYPKG;

The following equivalent JDBC types are required:

CREATE OR REPLACE TYPE MYPKG_TBL1 AS TABLE OF VARCHAR2(111)

CREATE OR REPLACE TYPE MYPKG_ARECORD AS OBJECT (
  T1 MYPKG_TBL1,
  T2 BOOLEAN
)