12.11.2014 Views

web server - Borland Technical Publications

web server - Borland Technical Publications

web server - Borland Technical Publications

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Container-managed data access support<br />

Important<br />

Note<br />

Important<br />

You specify your own optimized SQL in the <strong>Borland</strong> proprietary deployment descriptor,<br />

ejb-borland.xml. The XML grammar is identical to that found in ejb-jar.xml, except that<br />

the element is replaced with a element. This proprietary element<br />

contains a SQL-92 statement (not an EJB-QL statement) that is used to access the<br />

database instead of the CMP engine-generated SQL.<br />

The SELECT clause for this statement must be identical to the SELECT clause generated<br />

by the <strong>Borland</strong> CMP engine.<br />

Subsequent clauses are user-optimized. The ordering of the fields in the SELECT clause<br />

is proprietary to the CMP engine and therefore must be preserved.<br />

For example:<br />

<br />

EmployeeBean<br />

...<br />

<br />

<br />

findWealthyEmployees<br />

<br />

<br />

SELECT E.DEPT_NO, E.EMP_NO, E.FIRST_NAME, E.FULL_NAME,<br />

E.HIRE_DATE, E.JOB_CODE, E.JOB_COUNTRY,<br />

E.JOB_GRADE, E.LAST_NAME, E.PHONE_EXT, E.SALARY<br />

FROM EMPLOYEE E WHERE E.SALARY > 200000<br />

<br />

<br />

...<br />

<br />

The extensive SELECT statement reflects the type of SQL generated by the CMP engine.<br />

When the CMP engine encounters an EJB-QL statement in the ejb-jar.xml<br />

deployment descriptor, it checks ejb-borland.xml to see if there is any user SQL<br />

provided in the same bean's descriptor.<br />

If none is present, the CMP engine generates its own SQL and executes it.<br />

If the ejb-borland.xml descriptor does contain a query element, it uses the SQL within<br />

the tags instead.<br />

The element in ejb-borland.xml does not replace the element in the<br />

standard ejb-jar.xml deployment descriptor. If you want to override the CMP engine's<br />

SQL, you must provide the elements in both descriptors.<br />

Container-managed data access support<br />

For CMP, the <strong>Borland</strong> EJB Container supports all data types supported by the JDBC<br />

specification, including types beyond those supported by JDBC.<br />

The following table shows the basic and complex types supported by the <strong>Borland</strong> EJB<br />

Container:<br />

Basic types: boolean Boolean byte Byte char Character<br />

double Double float Float int Integer<br />

long Long short Short String java.sql.Date<br />

BigDecimal<br />

java.util.Date<br />

byte[]<br />

java.sql.Time<br />

java.sql.TimeStamp<br />

Chapter 17: EJB-QL and Data Access Support 159

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!