How to write expression-style finder methods for CMP entity beans.
See the chapter on writing entity beans in the Programmer's Guide |
Expression-based finder methods are finders that can be defined using the SilverStream expression language. You define the finder expression during the EJB JAR deployment process.
Setting up
To set up, follow these steps:
You can use the JAR Designer to do the following:
The expression builder presents the list of parameters included in the finder method's signature. The parameter names include the data type and the parameter's position as part of the variable name. For example, if the Finder method definition included another parameters, which was an integer, the expression builder would include javaLangInt1.
To specify an expression-based finder method in the DeployEJB XML input file, you need to add entries for tags in the obj_FinderMethod subsection of the input file. The following example shows how to define the Company demo finder method described in the previous section.
<obj_finderMethod> <obj_method> <name>findByLikeness</name> <methodParams type="String"> <el>java.lang.String</el> </methodParams> </obj_method> <finderMethodType>Expression</finderMethodType> <whereClause>Companies.companyname like javaLangString0</whereClause> </obj_finderMethod>