# @ejbgen:select Annotation

This tag specifies an select method for a CMP entity bean.

## Scope

A method tag on a CMP entity bean.

## Syntax

@ejbgen:select

[caching-name="CacheName"]

[ejb-ql="QueryLanguage"]

[group-name="GroupName"]

[include-updates="True/False"]

[max-elements="MaxNumber"]

[ordering-number="0...N"]

[result-type-mapping="Local/Remote"]

DEPRECATED [sql-select-distinct="True/False"]

[weblogic-ejb-ql="WebLogicEJBQueryLanguage"]

## Attributes

caching-name

Optional. Specifies the name of an eager relationship caching definition. For more details, see the ejbgen:relationship-caching-element Annotation and Accelerating Entity Bean Data Access.

ejb-ql

Optional. Specifies the EJB QL statement for this query.

group-name

Optional. This attribute defines which group-name will be eagerly loaded when returning the results of the query. For more details, see Accelerating Entity Bean Data Access.

include-updates

Optional. Specifies whether updates made during the current transaction must be reflected in the result of a query. Valid values are True and False. When this attribute is left unspecified, it defaults to true. For more details, see Accelerating Entity Bean Data Access.

max-elements

Optional. Specifies the maximum number of elements that should be returned by a query. When left unspecified, no maximum is set.

ordering-number

Optional. (0..n) Specifies the number where this method must appear in the generated class.

result-type-mapping

Optional. Specifies whether the returned objects are mapped to javax.ejb.EJBLocalObject or javax.ejb.EJBObject, that is, the remote or local (business) interface. Valid values are Remote and Local. If left unspecified, returned objects are mapped to the local interface.

sql-select-distinct

This attribute is deprecated. Please use the DISTINCT keyword in the EJB-QL instead.

weblogic-ejb-ql

Optional. Specifies the WebLogic QL statement for this query.

## Remarks

The following rules apply to this tag's use:

- The ejbgen:select tag is added to an ejbSelect method. In other words, unlike the ejbgen:finder tag, the tag is added to a method definition. To verify this, click a select method in Design View and notice that in Source View the tag is added to an ejbSelect method.

- Use either the ejb-ql or the weblogic-ejb-ql for the query executed for this finder method. When you specify queries for both attributes, the query specify for the ejb-ql attribute will be ignored.

Related Topics

How Do I: Add a Select Method to an Entity Bean?

Select Methods Sample

Query Methods and EJB-QL

@ejbgen:finder Annotation