blob: 5809d10b05bab8da11c1e278a0fb71af95742248 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Creating a DBWS Service from SQL Statements | EclipseLink 2.7 EclipseLink DBWS</title>
<meta name="generator" content="Oracle DARB XHTML Converter (Mode = document) - Version 1.0.22 Build 1" />
<meta name="date" content="2014-06-10T10:32:29Z" />
<meta name="robots" content="noarchive" />
<meta name="doctitle" content="Creating a DBWS Service from SQL Statements" />
<meta name="relnum" content="Release 2.7" />
<link rel="stylesheet" type="text/css" href="../../dcommon/style.css" media="screen" />
<link rel="copyright" href="../../dcommon/html/cpyr.htm" title="Copyright" type="text/html" />
<link rel="start" href="../../index.htm" title="Home" type="text/html" />
<link rel="contents" href="toc.htm" title="Contents" type="text/html" />
<link rel="prev" href="creating_dbws_services003.htm" title="Previous" type="text/html" />
<link rel="next" href="creating_dbws_services005.htm" title="Next" type="text/html" />
<!-- START: Disqus --><script type="text/javascript"> var disqus_developer = 0; </script><!-- END: Disqus --><!-- START: Sharethis --><script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script><script type="text/javascript" src="http://s.sharethis.com/loader.js"></script> <!-- END: Sharethis --></head>
<body bgcolor="#FFFFFF"><iframe id="docheader" frameborder="0" framemargin="0" scrolling="no" src="../../dcommon/header.html"></iframe><script src="http://www.google.com/jsapi" type="text/javascript"></script><script type="text/javascript"> google.load('search', '1', {language : 'en'}); google.setOnLoadCallback(function() { var customSearchOptions = {}; var googleAnalyticsOptions = {}; googleAnalyticsOptions['queryParameter'] = 'q'; googleAnalyticsOptions['categoryParameter'] = ''; customSearchOptions['googleAnalyticsOptions'] = googleAnalyticsOptions; var customSearchControl = new google.search.CustomSearchControl( '016171230611334810008:1hjujor5_fg', customSearchOptions); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setSearchFormRoot('cse-search-form'); customSearchControl.draw('cse', options); }, true);</script><link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" /><div id="cse" style="width:100%;"></div>
<div class="header"><a id="top" name="top"></a>
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="left" valign="top"><font face="helvetica, arial, sans-serif"><b>Developing Persistence Architectures Using EclipseLink Database Web Services</b><br />
<b>Release 2.7</b><br />
</font></td>
<td valign="bottom" align="right" width="144">
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>&nbsp;</td>
<td align="center" valign="top"><a href="toc.htm"><img src="../../dcommon/images/contents.png" alt="Go To Table Of Contents" border="0" height="16" width="16" /><br />
</td><td>&nbsp;</td><td align="center"><a href="../../" target="_top" class="external text" title="Search" rel="nofollow"><img src="../../dcommon/images/search.png" alt="Search" style="border:0;" /><br /><span class="mini"></span></a></td><td>&nbsp;</td><td align="center"><a href="../eclipselink_moxy.pdf" title="PDF" target="_blank"><img src="../../dcommon/images/pdf_icon.png" style="padding-right:5px;border:0" alt="PDF"></a></td>
</tr>
</table>
</td>
</tr>
</table>
<hr />
<table class="navigation simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100" align="center">
<tr>
<td align="center"><a href="creating_dbws_services003.htm"><img src="../../dcommon/images/larrow.png" alt="Previous" border="0" height="16" width="16" /></a></td>
<td align="center"><a href="creating_dbws_services005.htm"><img src="../../dcommon/images/rarrow.png" alt="Next" border="0" height="16" width="16" /></a></td>
<td>&nbsp;</td>
</tr>
</table>
</div>
<!-- class="header" -->
<div class="ind"><!-- End Header --><a id="CJAIFBBF" name="CJAIFBBF"></a><a id="TLDBW158" name="TLDBW158"></a>
<div class="sect1"><!-- infolevel="all" infotype="General" -->
<h1 class="sect1"><font face="arial, helvetica, sans-serif" color="#330099">Creating a DBWS Service from SQL Statements</font></h1>
<p>This section includes information on:</p>
<ul>
<li>
<p><a href="#CJAHDABI">Creating from Results Sets from Custom SQL SELECT Statements</a></p>
</li>
<li>
<p><a href="#CJAGABED">Creating based on Schema-formatted Results from Custom SQL SELECT Statements</a></p>
</li>
</ul>
<a id="CJAHDABI" name="CJAHDABI"></a><a id="TLDBW159" name="TLDBW159"></a>
<div class="sect2">
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Creating from Results Sets from Custom SQL SELECT Statements</font></h2>
<p>EclipseLink DBWS can create a Web service that exposes the results of executing custom SQL <code>SELECT</code> statements, without exposing the actual SQL. There is no metadata to determine the structure of the returned data -- the Simple XML Format schema is used.</p>
<p>The SQL <code>SELECT</code> statements targeted for this service are in the <code>DBWSBuilder</code> builder XML file, as shown here:</p>
<div class="example"><a id="TLDBW160" name="TLDBW160"></a><a id="sthref43" name="sthref43"></a>
<p><strong><em><font face="arial, helvetica, sans-serif">Example 2-8 Sample DBWSBuilder XML File</font></em></strong></p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;properties&gt;
&lt;property name="projectName"&gt;testSql&lt;/property&gt;
... database properties
&lt;/properties&gt;
&lt;sql
name="count"
simpleXMLFormatTag="aggregate-info"
xmlTag="count"
&gt;
&lt;text&gt;&lt;![CDATA[select count(*) from EMP]]&gt;&lt;/text&gt;
&lt;/sql&gt;
&lt;sql
name="countAndMaxSalary"
simpleXMLFormatTag="aggregate-info"
xmlTag="count-and-max-salary"
&gt;
&lt;text&gt;&lt;![CDATA[select count(*) as "COUNT", max(SAL) as "MAX-Salary" from EMP]]&gt;&lt;/text&gt;
&lt;/sql&gt;
&lt;/dbws-builder&gt;
</pre></div>
<!-- class="example" -->
<p>Use this command to create the web service:</p>
<pre xml:space="preserve" class="oac_no_warn">
prompt &gt; dbwsbuilder.cmd -builderFile dbws-builder.xml -stageDir output_directory -packageAs wls testSql.war
</pre>
<p>where</p>
<ul>
<li>
<p><code>dbws-builder.xml</code> is the DBWS builder XML configuration file, as shown previously</p>
</li>
<li>
<p><code>output_directory</code> is the output directory for the generated files</p>
</li>
<li>
<p><code>-packageA</code>s the platform on which the web service will be deployed</p>
</li>
</ul>
<p>The generated <code>eclipselink-dbws-schema.xsd</code> file is the schema for the Simple XML format:</p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
&gt;
&lt;xsd:complexType name="simple-xml-format"&gt;
&lt;xsd:sequence&gt;
&lt;xsd:any minOccurs="0"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:schema&gt;
</pre>
<p>The element tags <code>simple-xml-format</code> and <code>simple-xml</code> are customized in the SQL operations. For example, <code>&lt;simple-xml-format&gt;</code> = <code>&lt;aggregate-info&gt;</code>, <code>&lt;simple-xml&gt;</code> = <code>&lt;count-and-max-salary&gt;</code>.</p>
<a id="TLDBW161" name="TLDBW161"></a>
<div class="sect3"><a id="sthref44" name="sthref44"></a>
<h3 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Generated EclipseLink DBWS Service Descriptor</font></h3>
<p>The SQL operations are included in the DBWS service descriptor file (<code>eclipselink-dbws.xml</code>) created by EclipseLink, as well as the settings to alter the default Simple XML Format <code>&lt;element-tag&gt;</code> name.</p>
<div class="example"><a id="TLDBW162" name="TLDBW162"></a><a id="sthref45" name="sthref45"></a>
<p><strong><em><font face="arial, helvetica, sans-serif">Example 2-9 Sample XML File</font></em></strong></p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;dbws xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:testSql" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;name&gt;testSql&lt;/name&gt;
&lt;sessions-file&gt;eclipselink-dbws-sessions.xml&lt;/sessions-file&gt;
&lt;query&gt;
&lt;name&gt;count&lt;/name&gt;
&lt;result&gt;
&lt;type&gt;simple-xml-format&lt;/type&gt;
&lt;simple-xml-format&gt;
&lt;simple-xml-format-tag&gt;aggregate-info&lt;/simple-xml-format-tag&gt;
&lt;simple-xml-tag&gt;count&lt;/simple-xml-tag&gt;
&lt;/simple-xml-format&gt;
&lt;/result&gt;
&lt;sql&gt;
&lt;![CDATA[select count(*) from EMP]]&gt;
&lt;/sql&gt;
&lt;/query&gt;
&lt;query&gt;
&lt;name&gt;countAndMaxSalary&lt;/name&gt;
&lt;result&gt;
&lt;type&gt;simple-xml-format&lt;/type&gt;
&lt;simple-xml-format&gt;
&lt;simple-xml-format-tag&gt;aggregate-info&lt;/simple-xml-format-tag&gt;
&lt;simple-xml-tag&gt;count-and-max-salary&lt;/simple-xml-tag&gt;
&lt;/simple-xml-format&gt;
&lt;/result&gt;
&lt;sql&gt;
&lt;![CDATA[select count(*) as "COUNT", max(SAL) as "MAX-Salary" from EMP]]&gt;
&lt;/sql&gt;
&lt;/query&gt;
&lt;/dbws&gt;
</pre></div>
<!-- class="example" -->
<a id="CJABGDEG" name="CJABGDEG"></a><a id="TLDBW163" name="TLDBW163"></a>
<div class="sect4">
<h4 class="sect4"><font face="arial, helvetica, sans-serif" color="#330099">SOAP Messaging</font></h4>
<p>The following SOAP Message invokes the <code>&lt;count&gt;</code> operation for the <code>testSql</code> DBWS service:</p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"&gt;
&lt;env:Body&gt;
&lt;count xmlns="urn:testSqlService" xmlns:urn="urn:testSql"/&gt;
&lt;/env:Body&gt;
&lt;/env:Envelope&gt;
</pre>
<p>returning:</p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
&lt;SOAP-ENV:Header /&gt;
&lt;SOAP-ENV:Body&gt;
&lt;srvc:countResponse xmlns:srvc="urn:testSqlService"&gt;
&lt;srvc:result&gt;
&lt;aggregate-info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="simple-xml-format"&gt;
&lt;count&gt;
&lt;COUNT_x0028__x002A__x0029_&gt;14&lt;/COUNT_x0028__x002A__x0029_&gt;
&lt;/count&gt;
&lt;/aggregate-info&gt;
&lt;/srvc:result&gt;
&lt;/srvc:countResponse&gt;
&lt;/SOAP-ENV:Body&gt;
&lt;/SOAP-ENV:Envelope&gt;
</pre>
<div align="center">
<div class="inftblnote"><br />
<table class="Note oac_no_warn" summary="" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<td align="left">
<p class="note"><img src="../../dcommon/images/note_icon.png" width="16" height="16" alt="Note" style="vertical-align:middle;padding-right:5px;" />Note:</p>
<p>You should be aware of the <code>resultSet</code> for <code>select count(*);</code> the characters '(', '*' and ')' are not valid for XML element tags and are replaced by the well-known transformation, which documented as part of the SQL/X specification (SQL/XML:2003).</p>
</td>
</tr>
</tbody>
</table>
<br /></div>
<!-- class="inftblnote" --></div>
</div>
<!-- class="sect4" -->
<a id="TLDBW164" name="TLDBW164"></a>
<div class="sect4"><a id="sthref46" name="sthref46"></a>
<h4 class="sect4"><font face="arial, helvetica, sans-serif" color="#330099">Custom SQL as Sub-operation of Table-based Web Service</font></h4>
<p>The <a href="#CJABGDEG">"SOAP Messaging"</a> operation returns unstructured data. However, it is possible to nest such operations within the context of a Table-based operation; then, the nested operations can be configured to re-use the schema element type of the parent table and return structured data:</p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;dbws-builder&gt;
&lt;properties&gt;
&lt;property name="projectName"&gt;empSql&lt;/property&gt;
... database properties
&lt;/properties&gt;
&lt;table
catalogPattern="%"
tableNamePattern="EMP"
&gt;
&lt;sql
name="findEmpByName"
isCollection="true"
returnType="empType"
&gt;
&lt;text&gt;&lt;![CDATA[select * from EMP where ENAME like ?]]&gt;&lt;/text&gt;
&lt;binding name="ENAME" type="xsd:string"/&gt;
&lt;/sql&gt;
&lt;/table&gt;
&lt;/dbws-builder&gt;
</pre>
<p>The generated EclipseLink DBWS service descriptor <code>eclipselink-dbws.xml</code> file:</p>
<div class="example"><a id="TLDBW165" name="TLDBW165"></a><a id="sthref47" name="sthref47"></a>
<p><strong><em><font face="arial, helvetica, sans-serif">Example 2-10 Sample eclipselink-dbws.xml File</font></em></strong></p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;dbws xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:testSql" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;name&gt;empSql&lt;/name&gt;
&lt;sessions-file&gt;eclipselink-dbws-sessions.xml&lt;/sessions-file&gt;
&lt;update&gt;
&lt;name&gt;update_empType&lt;/name&gt;
&lt;parameter&gt;
&lt;name&gt;theInstance&lt;/name&gt;
&lt;type&gt;ns1:empType&lt;/type&gt;
&lt;/parameter&gt;
&lt;/update&gt;
...
&lt;query&gt;
&lt;name&gt;findEmpByName&lt;/name&gt;
&lt;parameter&gt;
&lt;name&gt;ENAME&lt;/name&gt;
&lt;type&gt;xsd:string&lt;/type&gt;
&lt;/parameter&gt;
&lt;result isCollection="true"&gt;
&lt;type&gt;ns1:empType&lt;/type&gt;
&lt;/result&gt;
&lt;sql&gt;
&lt;![CDATA[select * from EMP where ENAME like #ENAME]]&gt;
&lt;/sql&gt;
&lt;/query&gt;
&lt;/dbws&gt;
</pre></div>
<!-- class="example" --></div>
<!-- class="sect4" --></div>
<!-- class="sect3" --></div>
<!-- class="sect2" -->
<a id="CJAGABED" name="CJAGABED"></a><a id="TLDBW166" name="TLDBW166"></a>
<div class="sect2">
<h2 class="sect2"><font face="arial, helvetica, sans-serif" color="#330099">Creating based on Schema-formatted Results from Custom SQL SELECT Statements</font></h2>
<p>EclipseLink can also create a web service in which the "shape" of the returned result is determined at design-time, not runtime. Normally, the custom SQL <code>SELECT</code> statement returns <code>java.sql.ResultSets</code> and the <code>java.sql.ResultSetMetaData</code> APIs (<code>getColumnCount</code>, <code>getColumnLabel</code>, <code>getColumnType</code>, etc.) can be used to determine the name and datatype of the returned information.</p>
<p>EclipseLink DBWS uses the Simplified XML Format (SXF) to create an XML document to describe the ResultSet's information. However, because this document can change arbitrarily, the SXF schema is extremely "loose" &ndash; the use of <code>xsd:any</code> places virtually no restriction on the document.</p>
<div class="example"><a id="TLDBW167" name="TLDBW167"></a><a id="sthref48" name="sthref48"></a>
<p><strong><em><font face="arial, helvetica, sans-serif">Example 2-11 Sample Schema</font></em></strong></p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
&gt;
&lt;xsd:complexType name="simple-xml-format"&gt;
&lt;xsd:sequence&gt;
&lt;xsd:any minOccurs="0"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;/xsd:schema&gt;
</pre></div>
<!-- class="example" -->
<div class="example"><a id="TLDBW168" name="TLDBW168"></a><a id="sthref49" name="sthref49"></a>
<p><strong><em><font face="arial, helvetica, sans-serif">Example 2-12 Instance document:</font></em></strong></p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;source lang="xml"&gt;
&lt;?xml version = '1.0' encoding = 'UTF-8'?&gt;
&lt;simple-xml-format&gt;
&lt;simple-xml&gt;
&lt;EMPNO&gt;7788&lt;/EMPNO&gt;
&lt;ENAME&gt;SCOTT&lt;/ENAME&gt;
&lt;JOB&gt;ANALYST&lt;/JOB&gt;
&lt;MGR&gt;7566&lt;/MGR&gt;
&lt;HIREDATE&gt;1987-04-19&lt;/HIREDATE&gt;
&lt;SAL&gt;3000&lt;/SAL&gt;
&lt;DEPTNO&gt;20&lt;/DEPTNO&gt;
&lt;/simple-xml&gt;
&lt;simple-xml&gt;
&lt;EMPNO&gt;7369&lt;/EMPNO&gt;
&lt;ENAME&gt;SMITH&lt;/ENAME&gt;
&lt;JOB&gt;CLERK&lt;/JOB&gt;
&lt;MGR&gt;7902&lt;/MGR&gt;
&lt;HIREDATE&gt;1980-12-17&lt;/HIREDATE&gt;
&lt;SAL&gt;800&lt;/SAL&gt;
&lt;DEPTNO&gt;20&lt;/DEPTNO&gt;
&lt;/simple-xml&gt;
&lt;/simple-xml-format&gt;
</pre></div>
<!-- class="example" -->
<a id="TLDBW169" name="TLDBW169"></a>
<div class="sect3"><a id="sthref50" name="sthref50"></a>
<h3 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Additional information at Design Time</font></h3>
<p>As indicated previously, the <code>java.sql.ResultSetMetaData</code> APIs provide enough information, if available at design-time, from which you could generate a schema, as shown here:</p>
<div class="example"><a id="TLDBW170" name="TLDBW170"></a><a id="sthref51" name="sthref51"></a>
<p><strong><em><font face="arial, helvetica, sans-serif">Example 2-13 Sample Schema</font></em></strong></p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:emp" xmlns="urn:emp" elementFormDefault="qualified"&gt;
&lt;xsd:complexType name="empType"&gt;
&lt;xsd:sequence&gt;
&lt;xsd:element name="empno" type="xsd:decimal"/&gt;
&lt;xsd:element name="ename" type="xsd:string" minOccurs="0" nillable="true"/&gt;
&lt;xsd:element name="job" type="xsd:string" minOccurs="0" nillable="true"/&gt;
&lt;xsd:element name="mgr" type="xsd:decimal" minOccurs="0" nillable="true"/&gt;
&lt;xsd:element name="hiredate" type="xsd:date" minOccurs="0" nillable="true"/&gt;
&lt;xsd:element name="sal" type="xsd:decimal" minOccurs="0" nillable="true"/&gt;
&lt;xsd:element name="comm" type="xsd:decimal" minOccurs="0" nillable="true"/&gt;
&lt;xsd:element name="deptno" type="xsd:decimal" minOccurs="0" nillable="true"/&gt;
&lt;/xsd:sequence&gt;
&lt;/xsd:complexType&gt;
&lt;xsd:element name="empType" type="empType"/&gt;
&lt;/xsd:schema&gt;
</pre></div>
<!-- class="example" -->
<p>The DBWS sql operation is enhanced with an additional SQL statement that is executed at design-time -- the statement will not return any rows (such as when the <code>WHERE</code> clause evaluates to <strong>false</strong> in <a href="#CJADIADC">Example 2-14</a>):</p>
<div class="example"><a id="CJADIADC" name="CJADIADC"></a><a id="TLDBW171" name="TLDBW171"></a>
<p><strong><em><font face="arial, helvetica, sans-serif">Example 2-14 Executing Additional SQL Statements</font></em></strong></p>
<pre xml:space="preserve" class="oac_no_warn">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema"
&lt;properties&gt;
&lt;property name="projectName"&gt;emp&lt;/property&gt;
...
&lt;/properties&gt;
&lt;sql
name="Semployees"
isCollection="false"
returnType="empType"
&gt;
&lt;statement&gt;&lt;![CDATA[select * from EMP where ENAME like 'S%']]&gt;&lt;/statement&gt;
&lt;build-statement&gt;&lt;![CDATA[select * from EMP where 0=1]]&gt;&lt;/build-statement&gt;
&lt;/sql&gt;
&lt;/dbws-builder&gt;
</pre></div>
<!-- class="example" --></div>
<!-- class="sect3" -->
<a id="TLDBW172" name="TLDBW172"></a>
<div class="sect3"><a id="sthref52" name="sthref52"></a>
<h3 class="sect3"><font face="arial, helvetica, sans-serif" color="#330099">Understanding Issues and Limitations</font></h3>
<p>Be aware of the following limitation:</p>
<ul>
<li>
<p><a href="#CJAHCIHI">Repeated labels</a></p>
</li>
<li>
<p><a href="#CJAFBJEE">Compatible column label sets</a></p>
</li>
</ul>
<a id="CJAHCIHI" name="CJAHCIHI"></a><a id="TLDBW173" name="TLDBW173"></a>
<div class="sect4">
<h4 class="sect4"><font face="arial, helvetica, sans-serif" color="#330099">Repeated labels</font></h4>
<p>Valid SQL allows multiple identical columns. For example, consider the following SQL:</p>
<pre xml:space="preserve" class="oac_no_warn">
SELECT ENAME, ENAME FROM EMP WHERE LIKE 'S%'
</pre>
<div class="inftblhruleinformal">
<table class="HRuleInformal" title="Sample Table Repeated Labels" summary="This is a sample table showing how valid SQL allows multiple identical columns." dir="ltr" border="1" width="100%" frame="hsides" rules="rows" cellpadding="3" cellspacing="0">
<col width="*" />
<col width="50%" />
<thead>
<tr align="left" valign="top">
<th align="left" valign="bottom" id="r1c1-t5"><font face="Arial, Helvetica, sans-serif"><strong>ENAME</strong></font></th>
<th align="left" valign="bottom" id="r1c2-t5"><font face="Arial, Helvetica, sans-serif"><strong>ENAME</strong></font></th>
</tr>
</thead>
<tbody>
<tr align="left" valign="top">
<td align="left" id="r2c1-t5" headers="r1c1-t5">
<p>SMITH</p>
</td>
<td align="left" headers="r2c1-t5 r1c2-t5">
<p>SMITH</p>
</td>
</tr>
<tr align="left" valign="top">
<td align="left" id="r3c1-t5" headers="r1c1-t5">
<p>...</p>
</td>
<td align="left" headers="r3c1-t5 r1c2-t5">
<p>...</p>
</td>
</tr>
<tr align="left" valign="top">
<td align="left" id="r4c1-t5" headers="r1c1-t5">
<p>SCOTT</p>
</td>
<td align="left" headers="r4c1-t5 r1c2-t5">
<p>SCOTT</p>
</td>
</tr>
</tbody>
</table>
<br /></div>
<!-- class="inftblhruleinformal" -->
<p>In this example, a <code>SELECT</code> statement that uses <code>UNION</code> could return a set of column labels where a label is repeated.</p>
<p><code>DBWSBuilder</code> maintains a list of "already processed columns" and will throw an exception when it detects a duplicate.</p>
</div>
<!-- class="sect4" -->
<a id="CJAFBJEE" name="CJAFBJEE"></a><a id="TLDBW174" name="TLDBW174"></a>
<div class="sect4">
<h4 class="sect4"><font face="arial, helvetica, sans-serif" color="#330099">Compatible column label sets</font></h4>
<p>The runtime and design-time SQL statements <strong>must</strong> return compatible column label sets. EclipseLink performs no pre-processing to ensure that the column sets are the same; the error will be detected at runtime when the service is invoked.</p>
</div>
<!-- class="sect4" --></div>
<!-- class="sect3" --></div>
<!-- class="sect2" --></div>
<!-- class="sect1" --></div>
<!-- class="ind" -->
<!-- Start Footer -->
<div class="footer">
<hr />
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<col width="33%" />
<col width="*" />
<col width="33%" />
<tr>
<td valign="bottom">
<table class="navigation simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100" align="center">
<col width="*" />
<col width="48%" />
<col width="48%" />
<tr>
<td>&nbsp;</td>
<td align="center"><a href="creating_dbws_services003.htm"><img src="../../dcommon/images/larrow.png" alt="Previous" border="0" height="16" width="16" /></a></td>
<td align="center"><a href="creating_dbws_services005.htm"><img src="../../dcommon/images/rarrow.png" alt="Next" border="0" height="16" width="16" /></a></td>
</tr>
</table>
</td>
<td align="center" width="34%"><a href="http://www.eclipse.org/eclipselink/" title="EclipseLink home"><img src="../../dcommon/images/ellogo.png" alt="EclipseLink" width="150" border="0" /></a><br />
<td valign="bottom" align="right">
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="225">
<tr>
<td>&nbsp;</td>
<td align="center" valign="top"><a href="toc.htm"><img src="../../dcommon/images/contents.png" alt="Go To Table Of Contents" border="0" height="16" width="16" /><br />
</td><td>&nbsp;</td><td align="center"><a href="../../" target="_top" class="external text" title="Search" rel="nofollow"><img src="../../dcommon/images/search.png" alt="Search" style="border:0;" /><br /><span class="mini"></span></a></td><td>&nbsp;</td><td align="center"><a href="../eclipselink_moxy.pdf" title="PDF" target="_blank"><img src="../../dcommon/images/pdf_icon.png" style="padding-right:5px;border:0" alt="PDF"></a></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- class="footer" -->
<div id="copyright">Copyright &copy; 2014 by The Eclipse Foundation under the <a href="http://www.eclipse.org/org/documents/epl-v10.php">Eclipse Public License (EPL)</a><br /> <script type="text/javascript">var LastUpdated = document.lastModified;document.writeln ("Updated: " + LastUpdated);</script> </div><!-- START: Analytics --><script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1608008-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script><!-- END: Analytics --><!-- START: Sharethis --><script>var options={ "publisher": "e2fe9e07-fab6-4f84-83ea-0991b429842c", "position": "right", "ad": { "visible": false, "openDelay": 5, "closeDelay": 0}};var st_hover_widget = new sharethis.widgets.hoverbuttons(options);</script><!-- END: Sharethis --></body>
</html>