Used to setup various options for an entity find (query). All methods to set options modify the option then return this modified object to allow method call chaining. It is important to note that this object is not immutable and is modified internally, and returning EntityFind is just a self reference for convenience. Even after a query a find object can be modified and then used to perform another query.
| Type | Name and description |
|---|---|
EntityFind |
condition(java.lang.String fieldName, java.lang.Object value)Add a field to the find (where clause). |
EntityFind |
condition(java.lang.String fieldName, ComparisonOperator operator, java.lang.Object value)Compare the named field to the value using the operator. |
EntityFind |
condition(java.lang.String fieldName, java.lang.String operator, java.lang.Object value) |
EntityFind |
condition(java.util.Map<java.lang.String, java.lang.Object> fields)Add a Map of fields to the find (where clause). |
EntityFind |
condition(EntityCondition condition)Add a EntityCondition to the find (where clause). |
EntityFind |
conditionDate(java.lang.String fromFieldName, java.lang.String thruFieldName, java.sql.Timestamp compareStamp)Add conditions for the standard effective date query pattern including from field is null or earlier than or equal to compareStamp and thru field is null or later than or equal to compareStamp. |
EntityFind |
conditionToField(java.lang.String fieldName, ComparisonOperator operator, java.lang.String toFieldName)Compare a field to another field using the operator. |
long |
count()Runs a find with current options to get a count of matching records. |
long |
deleteAll()Delete entity records that match a condition. |
EntityFind |
disableAuthz() |
EntityFind |
distinct(boolean distinct)Specifies whether the values returned should be filtered to remove duplicate values. |
EntityFind |
entity(java.lang.String entityName)The Name of the Entity to use, as defined in an entity XML file. |
EntityFind |
fetchSize(java.lang.Integer fetchSize)The JDBC fetch size for this query. |
EntityFind |
forUpdate(boolean forUpdate)Lock the selected record so only this transaction can change it until it is ended. |
boolean |
getDistinct() |
java.lang.String |
getEntity() |
java.lang.Integer |
getFetchSize() |
boolean |
getForUpdate() |
boolean |
getHasCondition() |
boolean |
getHasHavingCondition() |
EntityCondition |
getHavingEntityCondition()Get the current having EntityCondition. |
java.lang.Integer |
getLimit() |
java.lang.Integer |
getMaxRows() |
java.lang.Integer |
getOffset() |
java.util.List<java.lang.String> |
getOrderBy() |
int |
getPageIndex()For use with searchFormInputs when paginated. |
int |
getPageSize()For use with searchFormInputs when paginated. |
int |
getResultSetConcurrency() |
int |
getResultSetType() |
java.util.List<java.lang.String> |
getSelectFields() |
boolean |
getUseCache() |
EntityCondition |
getWhereEntityCondition()Get the current where EntityCondition. |
EntityFind |
havingCondition(EntityCondition condition)Add a EntityCondition to the having clause of the find. |
EntityListIterator |
iterator()Runs a find with current options and returns an EntityListIterator object. |
EntityFind |
limit(java.lang.Integer limit)The limit, ie max number of rows to return. |
EntityList |
list()Runs a find with current options to get a list of records. |
java.util.List<java.util.Map<java.lang.String, java.lang.Object>> |
listMaster(java.lang.String name)Runs a find with current options to get a list of records, then for each result gets all related/dependent entities according to the named master definition (default name is 'default') |
EntityDynamicView |
makeEntityDynamicView()Make a dynamic view object to use instead of the entity name (if used the entity name will be ignored). |
EntityFind |
maxRows(java.lang.Integer maxRows)The JDBC max rows for this query. |
EntityFind |
offset(java.lang.Integer offset)The offset, ie the starting row to return. |
EntityFind |
offset(int pageIndex, int pageSize)Specify the offset in terms of page index and size. |
EntityValue |
one()Runs a find with current options to get a single record by primary key. |
java.util.Map<java.lang.String, java.lang.Object> |
oneMaster(java.lang.String name)Runs a find with current options to get a single record by primary key, then gets all related/dependent entities according to the named master definition (default name is 'default'). |
EntityFind |
orderBy(java.lang.String orderByFieldName)A field of the find entity to order the query by. |
EntityFind |
orderBy(java.util.List<java.lang.String> orderByFieldNames)Each List entry is passed to the orderBy(String orderByFieldName) method, see it for details. |
EntityFind |
resultSetConcurrency(int resultSetConcurrency)Specifies whether or not the ResultSet can be updated. |
EntityFind |
resultSetType(int resultSetType)Specifies how the ResultSet will be traversed. |
EntityFind |
searchFormInputs(java.lang.String inputFieldsMapName, java.lang.String defaultOrderBy, boolean alwaysPaginate)Adds conditions for the fields found in the inputFieldsMapName Map. |
EntityFind |
searchFormMap(java.util.Map<java.lang.String, java.lang.Object> inputFieldsMap, java.util.Map<java.lang.String, java.lang.Object> defaultParameters, java.lang.String skipFields, java.lang.String defaultOrderBy, boolean alwaysPaginate) |
EntityFind |
selectField(java.lang.String fieldToSelect)The field of the named entity to get from the database. |
EntityFind |
selectFields(java.util.Collection<java.lang.String> fieldsToSelect)The fields of the named entity to get from the database; if empty or null all fields will be retrieved. |
boolean |
shouldCache() |
long |
updateAll(java.util.Map<java.lang.String, ?> fieldsToSet)Update a set of values that match a condition. |
EntityFind |
useCache(java.lang.Boolean useCache)Look in the cache before finding in the datasource. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Add a field to the find (where clause). If a field has been set with the same name, this will replace that field's value. If any other constraints are already in place this will be ANDed to them.
Compare the named field to the value using the operator.
Add a Map of fields to the find (where clause).
If a field has been set with the same name and any of the Map keys, this will replace that field's value.
Fields set in this way will be combined with other conditions (if applicable) just before doing the query.
This will do conversions if needed from Strings to field types as needed, and will only get keys that match
entity fields. In other words, it does the same thing as:
EntityValue.setFields(fields, true, null, null)
Add a EntityCondition to the find (where clause).
Add conditions for the standard effective date query pattern including from field is null or earlier than or equal to compareStamp and thru field is null or later than or equal to compareStamp.
Compare a field to another field using the operator.
Runs a find with current options to get a count of matching records.
Delete entity records that match a condition.
Specifies whether the values returned should be filtered to remove duplicate values. Default is false.
The Name of the Entity to use, as defined in an entity XML file.
The JDBC fetch size for this query. Default (null) will fall back to datasource settings. This is not the fetch as in the OFFSET/FETCH SQL clause (use limit for that), and is rather the JDBC fetch to determine how many rows to get back on each round-trip to the database. Only applicable for list() and iterator() finds.
Lock the selected record so only this transaction can change it until it is ended. If this is set when the find is done the useCache setting will be ignored as this will always get the data from the database. Default is false.
Get the current having EntityCondition.
For use with searchFormInputs when paginated. Equals offset (default 0) divided by page size.
For use with searchFormInputs when paginated. Equals limit (default 20; exists for consistency/convenience along with getPageIndex()).
Get the current where EntityCondition.
Add a EntityCondition to the having clause of the find. If any having constraints are already in place this will be ANDed to them.
Runs a find with current options and returns an EntityListIterator object. This method ignores the cache setting and always gets results from the database.
The limit, ie max number of rows to return. Default (null) means all rows. Only applicable for list() and iterator() finds.
Runs a find with current options to get a list of records.
Runs a find with current options to get a list of records, then for each result gets all related/dependent entities according to the named master definition (default name is 'default')
Make a dynamic view object to use instead of the entity name (if used the entity name will be ignored). If called multiple times will return the same object.
The JDBC max rows for this query. Default (null) will fall back to datasource settings. This is the maximum number of rows the ResultSet will keep in memory at any given time before releasing them and if requested they are retrieved from the database again. Only applicable for list() and iterator() finds.
The offset, ie the starting row to return. Default (null) means start from the first actual row. Only applicable for list() and iterator() finds.
Specify the offset in terms of page index and size. Actual offset is pageIndex * pageSize.
Runs a find with current options to get a single record by primary key.
Runs a find with current options to get a single record by primary key, then gets all related/dependent entities according to the named master definition (default name is 'default').
A field of the find entity to order the query by. Optionally add a " ASC" to the end or "+" to the beginning for ascending, or " DESC" to the end of "-" to the beginning for descending. If any other order by fields have already been specified this will be added to the end of the list. The String may be a comma-separated list of field names. Only fields that actually exist on the entity will be added to the order by list.
Each List entry is passed to the orderBy(String orderByFieldName) method, see it for details.
Specifies whether or not the ResultSet can be updated. Available values: ResultSet.CONCUR_READ_ONLY (default) or ResultSet.CONCUR_UPDATABLE. Should pretty much always be ResultSet.CONCUR_READ_ONLY with the Entity Facade since updates are generally done as separate operations. Defaults to CONCUR_READ_ONLY.
Specifies how the ResultSet will be traversed. Available values: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE (default) or ResultSet.TYPE_SCROLL_SENSITIVE. See the java.sql.ResultSet JavaDoc for more information. If you want it to be fast, use the common option: ResultSet.TYPE_FORWARD_ONLY. For partial results where you want to jump to an index make sure to use TYPE_SCROLL_INSENSITIVE. Defaults to ResultSet.TYPE_SCROLL_INSENSITIVE.
Adds conditions for the fields found in the inputFieldsMapName Map. The fields and special fields with suffixes supported are the same as the *-find fields in the XML Forms. This means that you can use this to process the data from the various inputs generated by XML Forms. The suffixes include things like *_op for operators and *_ic for ignore case. For historical reference, this does basically what the Apache OFBiz prepareFind service does.
inputFieldsMapName - The map to get form fields from. If empty will look at the ec.web.parameters map if
the web facade is available, otherwise the current context (ec.context).defaultOrderBy - If there is not an orderByField parameter this is used instead.alwaysPaginate - If true pagination offset/limit will be set even if there is no pageIndex parameter.The field of the named entity to get from the database. If any select fields have already been specified this will be added to the set.
The fields of the named entity to get from the database; if empty or null all fields will be retrieved.
Update a set of values that match a condition.
fieldsToSet - The fields of the named entity to set in the databaseLook in the cache before finding in the datasource. Defaults to setting on entity definition.