这就是定制查找器助手的用武之地。
查找器方法可以拥有任意输入参数。
现在,让我们回到查找器方法。
所有的查找器方法都由容器来处理。
我将之称为查找器方法或查找器。
有四种类型的定制查找器可用。
作为查找器方法的输入参数的占位符。
As a placeholder for the input parameter on the finder method.
这个查找器的where子句相当简单。
注册表查找器允许您浏览本地注册表;
查找器的返回值通常是DAO负责的域对象集合。
The return value of a finder is normally a collection of the domain object for which the DAO is responsible.
打开路径查找器面板,点击”分割“按钮。
Bring up the Pathfinder palette and click the Divide button.
这种查询已经超出了我们刚刚看到的动态查找器的能力。
That kind of query is beyond the capabilities of the dynamic finders that we just saw.
与2.0版注册表查找器开始不只是一个取景器。
Starting with version 2.0 Registry finder is not just a finder.
最后我们需要在查找器方法与数据库中的结果行之间建立映射。
The last mapping we need is between the finder methods and the result rows in the database.
查看执行查找器方法的代码(只编写了一次!)来结束我的讨论。
I conclude my discussion with a look at the code (written just once!) that executes my finder methods.
Grails为你所能想到的每个查询组合自动提供动态查找器!
Grails automatically provides dynamic finders for just about every query combination you can think of!
该示例显示了两个查找器方法以及FinderHelper接口。
The example below shows two finder methods and the FinderHelper interface.
将每个查找器的命名查询添加到域对象的hbm . xml映射文件。
Add a named query for each finder method to the hbm.xml mapping file for the domain object.
定制查找器助手允许应用程序与ejb容器一起工作来访问适当的EJB。
Custom finder helpers allow applications to work with the EJB container to access the appropriate EJBs.
NI范例查找器就是一个用于查找这些例子的非常有用的工具。
The NI example Finder is a very useful tool that assists in the search for these examples.
定义一个接口,它扩展GenericDao并包含所需的任何查找器方法。
Define an interface that extends GenericDao and contains any finder methods you need.
根据这些网关实体来构建应用程序概要文件和自定义查找器,以重用协调参数。
Build application profiles and custom finders around these gateway entities to reuse the tuning parameters.
查找器方法返回bean的Remote接口或一个Remote接口的枚举。
Finder methods return the bean's Remote interface or an enumeration of Remote interfaces.
因为查找器方法是特定于每个域对象的,因此将其应用于泛型DAO的类型化接口。
Because the finder methods are specific to each domain object, they are applied to the typed interfaces of the generic DAO.
这些查找器方法中的每一个都将接受不同的参数,每一个都可以返回一个或多个差事。
Each of these finder methods will accept different parameters, and each may return one errand or multiple errands.
现在闭合中间的空白区域,选择所有的形状,按路径查找器中的合并按钮。
Now fill the empty space in the middle, select all the shapes and merge them with the Pathfinder.
在第一个字符串中,再遵守另一个命名约定—查找器方法名加WhereClause。
In the first string, again a naming convention is followed — finder method name plus WhereClause.
下面,定义负责调用查找器类的类——CustomerLister,如清单3所示。
Next, you define the class that is responsible for calling the finder class — CustomerLister, shown in Listing 3.
现在来看一下FinderHelper接口,该接口与这两个查找器方法一起联合使用。
Now look at the FinderHelper interface that is used in conjunction with these two finder methods.
接下来,对这个member类和能返回mock_member的查找器进行mock。
Next, I actually mock the member class and mock a finder that returns mock_member.
应用推荐