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.

Overriding SQL generated from EJB-QL by the CMP engine<br />

The ejbSelects for dynamic queries are:<br />

public java.util.Collection selectDynamicLocal(java.lang.String ejbql,<br />

Class[] types, Object[] params)<br />

throws javax.ejb.FinderException<br />

public java.util.Collection selectDynamicLocal(java.lang.String ejbql, Class[]<br />

types, Object[] params, java.lang.String sql)<br />

throws javax.ejb.FinderException<br />

public java.util.Collection selectDynamicRemote(java.lang.String ejbql,<br />

Class[] types, Object[] params)<br />

throws javax.ejb.FinderException<br />

public java.util.Collection selectDynamicRemote(java.lang.String ejbql, Class[]<br />

types, Object[] params, java.lang.String sql)<br />

throws javax.ejb.FinderException<br />

public java.sql.ResultSet selectDynamicResultSet(java.lang.String ejbql,<br />

Class[] types, Object[] params)<br />

throws javax.ejb.FinderException<br />

Note<br />

public java.sql.ResultSet selectDynamicResultSet(java.lang.String ejbql,<br />

Class[] types, Object[] params, java.lang.String sql)<br />

throws javax.ejb.FinderException<br />

where the following applies:<br />

■<br />

■<br />

■<br />

■<br />

java.lang.String ejbql: this represents the actual EJB-QL syntax.<br />

Class[] types: this array gives the class types of the parameters to the select or<br />

finder method (it can be an empty array if there are no parameters).<br />

Object[] params: this array gives the actual values of the parameters. This is the<br />

same as the parameters argument of the regular select or finder method.<br />

The return type of a dynamic select or finder is always java.util.Collection, with<br />

the exception of the selectDynamicResultSet. If there is a single instance of the object<br />

or value type returned from the query, it is the first member of the collection.<br />

Dynamic queries follow the same rules as regular queries.<br />

java.lang.String sql: User specified sql. If specified, this will override the sql<br />

generated by EJB-QL.<br />

There should not be any trace of the eight methods associated with dynamic queries in<br />

your deployment descriptor.<br />

Overriding SQL generated from EJB-QL by the CMP engine<br />

Important<br />

Note<br />

This feature is for advanced users only!<br />

The <strong>Borland</strong> CMP engine generates SQL calls to your database based on the EJB-QL<br />

you enter in your deployment descriptors. Depending on your database<br />

implementation, the generated SQL may be less than optimal. You can capture the<br />

generated SQL using tools supplied by your backing-store implementation or another<br />

development tool. If the generated SQL is not optimal, you can replace it with your<br />

own. However, we offer no validation on the user SQL.<br />

A problem with your SQL may generate an exception which can potentially crash the<br />

system.<br />

158 BES Developer’s Guide

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

Saved successfully!

Ooh no, something went wrong!