user manual
138 BES Developer’s Guide
Container-Managed Persistence in Borland Enterprise Server
container. When that flag is enabled, it prints the exact statements constructed
by the Container.
While other EJB Container products use code generation to support CMP, the
Borland Container does not use code generation because it has serious
limitations. For example, code generation makes it difficult to support a "tuned
update" feature, because of the great number of different update statements
to container-managed fields that are required.
Constructing the where clause
The where clause is a necessary part of select statements when you want to
delimit the extent of the returned records. Because the where clause syntax can
be fairly complex, you must follow certain rules in the XML deployment
descriptor file so that the EJB Container can correctly construct this clause.
To begin with, you are not obligated to use the literal "where" in your <where-
clause>. You can construct a where clause without this literal and rely on the
Container to supply it. However, the Container only does this if the <where-
clause> is not an empty string; it leaves empty strings empty. For example, you
could define a where clause as either:
<where-clause> where a = b </where-clause>
or:
<where-clause> a = b </where-clause>
The Container converts a = b to the same where clause, where a = b. However,
it leaves unmodified an empty string defined as <where-clause> "" </where-
clause>.
Note The empty string makes it easy to specify the findAll() method. When you
specify just an empty string, the Container construes that to mean the
following:
select [values] from [table];
Such a select statement would return all values from a particular table.
Parameter substitution
Parameter substitution is an important part of the where clause. The Borland
EJB Container does parameter substitution wherever it finds the standard
SQL substitution prefix colon (:). Each parameter for substitution corresponds
to a name of a parameter in the finder specification found in the XML
descriptor.
For example, in the XML deployment descriptor, you might define the following
finder method which takes a parameter balance (note that balance is preceded
by a colon):
<finder>
<method-signature>findAccountsLargerThan(float balance)</method-
signature>
<where-clause>balance > :balance</where-clause>
</finder>










