public class EntityFindOptions extends Object implements Serializable
EntityFindOptions options1 = new EntityFindOptions().distinct().limit(10);
EntityFindOptions options2 = EntityFindOptions.findOptions()
.scrollInsensitive()
.updatable()
.fetchSize(30);
| Modifier and Type | Field and Description |
|---|---|
static int |
CONCUR_READ_ONLY
Deprecated.
use the original constant instead
|
static int |
CONCUR_UPDATABLE
Deprecated.
use the original constant instead
|
protected boolean |
distinct |
protected int |
fetchSize |
protected int |
maxResults
maximum results to obtain from DB - negative values mean no limit
|
protected int |
offset |
protected int |
resultSetConcurrency |
protected int |
resultSetType |
protected boolean |
specifyTypeAndConcurrency |
static int |
TYPE_FORWARD_ONLY
Deprecated.
use the original constant instead
|
static int |
TYPE_SCROLL_INSENSITIVE
Deprecated.
use the original constant instead
|
static int |
TYPE_SCROLL_SENSITIVE
Deprecated.
use the original constant instead
|
| Constructor and Description |
|---|
EntityFindOptions()
Default constructor.
|
EntityFindOptions(boolean specifyTypeAndConcurrency,
int resultSetType,
int resultSetConcurrency,
boolean distinct,
int maxResults)
Deprecated.
since 1.0.27 - Please use the chained form as shown in the
examples. |
| Modifier and Type | Method and Description |
|---|---|
EntityFindOptions |
distinct()
Same as
setDistinct(true). |
EntityFindOptions |
fetchSize(int fetchSize)
Same as
setFetchSize(int). |
static EntityFindOptions |
findOptions()
Creates a new
EntityFindOptions. |
EntityFindOptions |
forwardOnly()
Same as using both
setSpecifyTypeAndConcur(true)
and setResultSetType(TYPE_FORWARD_ONLY). |
boolean |
getDistinct()
Indicates whether the values returned will be filtered to remove duplicate values.
|
int |
getFetchSize()
Specifies the value to use for the fetch size on the prepared statement.
|
int |
getMaxResults()
Specifies the maximum number of results to be returned by the query.
|
int |
getOffset()
Returns the number of rows to be skipped.
|
int |
getResultSetConcurrency()
Specifies whether or not the ResultSet can be updated.
|
int |
getResultSetType()
Indicates how the ResultSet will be traversed.
|
boolean |
getSpecifyTypeAndConcur()
Deprecated.
use
isCustomResultSetTypeAndConcurrency() instead; better named |
boolean |
isCustomResultSetTypeAndConcurrency()
Indicates whether the
resultSetType and resultSetConcurrency
fields will be used to specify how the results will be used; false means that
the JDBC driver's default values will be used. |
EntityFindOptions |
maxResults(int maxResults)
Same as
setMaxResults(int). |
EntityFindOptions |
range(int offset,
int maxResults)
Specifies the range of results to find.
|
EntityFindOptions |
readOnly()
Same as using both
setSpecifyTypeAndConcur(true)
and setResultSetConcurrency(int) setResultSetConcurrency(CONCUR_READ_ONLY)}. |
EntityFindOptions |
scrollInsensitive()
Same as using both
setSpecifyTypeAndConcur(true)
and setResultSetType(TYPE_SCROLL_INSENSITIVE). |
EntityFindOptions |
scrollSensitive()
Same as using both
setSpecifyTypeAndConcur(true)
and setResultSetType(TYPE_SCROLL_SENSITIVE). |
void |
setDistinct(boolean distinct)
Specifies whether the values returned should be filtered to remove duplicate values.
|
void |
setFetchSize(int fetchSize)
Specifies the value to use for the fetch size on the prepared statement.
|
void |
setMaxResults(int maxResults)
Specifies the maximum number of results to be returned by the query.
|
void |
setOffset(int offset)
Specifies the number of rows to be skipped, which is ignored if
maxResults is not also set. |
void |
setResultSetConcurrency(int resultSetConcurrency)
Specifies whether or not the ResultSet can be updated.
|
void |
setResultSetType(int resultSetType)
Specifies how the ResultSet will be traversed.
|
void |
setSpecifyTypeAndConcur(boolean specifyTypeAndConcurrency)
Deprecated.
there's no valid use case for this method; call
useDriverDefaultsForTypeAndConcurrency() to
revert to the driver's default settings for concurrency and type of result set |
EntityFindOptions |
updatable()
Same as using both
setSpecifyTypeAndConcur(true)
and setResultSetConcurrency(int) setResultSetConcurrency(CONCUR_UPDATABLE)}. |
void |
useDriverDefaultsForTypeAndConcurrency()
Specifies that the JDBC driver's default values should be used for concurrency and type of result set, in other
words any custom settings for those options should be ignored.
|
@Deprecated public static final int TYPE_FORWARD_ONLY
@Deprecated public static final int TYPE_SCROLL_INSENSITIVE
@Deprecated public static final int TYPE_SCROLL_SENSITIVE
@Deprecated public static final int CONCUR_READ_ONLY
@Deprecated public static final int CONCUR_UPDATABLE
protected boolean specifyTypeAndConcurrency
protected int resultSetType
protected int resultSetConcurrency
protected boolean distinct
protected int maxResults
protected int offset
protected int fetchSize
public EntityFindOptions()
@Deprecated public EntityFindOptions(boolean specifyTypeAndConcurrency, int resultSetType, int resultSetConcurrency, boolean distinct, int maxResults)
examples.specifyTypeAndConcurrency - if false, then resultSetType and resultSetConcurrency are ignored, and the
JDBC driver's defaults are used for these fields, insteadresultSetType - either TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, or TYPE_SCROLL_SENSITIVEresultSetConcurrency - either CONCUR_READ_ONLY, or CONCUR_UPDATABLEdistinct - if true, then the DISTINCT SQL keyword is used in the querymaxResults - if specified, then this value is used to limit the number of results retrieved,
by using LIMIT on MySQL, ROWNUM on Oracle, and so onpublic static EntityFindOptions findOptions()
EntityFindOptions. This is equivalent to the
default constructor, but is implemented as
a static method so that it can be used more conveniently by other
classes that static import it.
Example:
import org.ofbiz.core.entity.EntityFindOptions;
import static org.ofbiz.core.entity.EntityFindOptions.findOptions;
[...]
{
EntityFindOptions options = findOptions().distinct().maxEntries(5);
[...]
}
@Deprecated public boolean getSpecifyTypeAndConcur()
isCustomResultSetTypeAndConcurrency() instead; better namedresultSetType and resultSetConcurrency
fields will be used to specify how the results will be used; false means that
the JDBC driver's default values will be used.public boolean isCustomResultSetTypeAndConcurrency()
resultSetType and resultSetConcurrency
fields will be used to specify how the results will be used; false means that
the JDBC driver's default values will be used.@Deprecated public void setSpecifyTypeAndConcur(boolean specifyTypeAndConcurrency)
useDriverDefaultsForTypeAndConcurrency() to
revert to the driver's default settings for concurrency and type of result setresultSetType and
resultSetConcurrency parameters will be used to specify how the
results will be used; if false, the JDBC driver's default values will be
used.specifyTypeAndConcurrency - see abovepublic void useDriverDefaultsForTypeAndConcurrency()
public int getResultSetType()
setResultSetType(int)public void setResultSetType(int resultSetType)
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, and
ResultSet.TYPE_SCROLL_SENSITIVE. If you want it to be fast, use
the common default, ResultSet.TYPE_FORWARD_ONLY.resultSetType - the result set type to setpublic int getResultSetConcurrency()
public void setResultSetConcurrency(int resultSetConcurrency)
resultSetConcurrency - the value to setpublic boolean getDistinct()
public void setDistinct(boolean distinct)
distinct - whether to return only unique valuespublic int getMaxResults()
public void setMaxResults(int maxResults)
maxResults - ignored if zero or lesspublic int getOffset()
public void setOffset(int offset)
maxResults is not also set.offset - if negative, this method does nothingpublic int getFetchSize()
setFetchSize(int) for restrictions.public void setFetchSize(int fetchSize)
WARNING: This setting is a hint for the database driver, and the driver
is not required to honour it! Several databases put other restrictions on its
use as well. Postgres will definitely ignore this setting when the database connection
is in auto-commit mode, so you will probably have to use the TransactionUtil
if you want this to work.
WARNING: This value may need to be set to a database-dependent value. For example,
the most useful value on MySQL is Integer.MIN_VALUE to get a streaming result
set, but this value will be rejected by most other databases.
public EntityFindOptions forwardOnly()
setSpecifyTypeAndConcur(true)
and setResultSetType(TYPE_FORWARD_ONLY). Note that you
should also use either readOnly() or updatable() for maximum driver
compatibility.this, for convenient use as a chained builderpublic EntityFindOptions scrollSensitive()
setSpecifyTypeAndConcur(true)
and setResultSetType(TYPE_SCROLL_SENSITIVE). Note that you
should also use either readOnly() or updatable() for maximum driver
compatibility.this, for convenient use as a chained builderpublic EntityFindOptions scrollInsensitive()
setSpecifyTypeAndConcur(true)
and setResultSetType(TYPE_SCROLL_INSENSITIVE). Note that you
should also use either readOnly() or updatable() for maximum driver
compatibility.this, for convenient use as a chained builderpublic EntityFindOptions readOnly()
setSpecifyTypeAndConcur(true)
and setResultSetConcurrency(int) setResultSetConcurrency(CONCUR_READ_ONLY)}. Note that you
should also use forwardOnly(), scrollSensitive() or scrollInsensitive()
for maximum driver compatibility.this, for convenient use as a chained builderpublic EntityFindOptions updatable()
setSpecifyTypeAndConcur(true)
and setResultSetConcurrency(int) setResultSetConcurrency(CONCUR_UPDATABLE)}. Note that you
should also use forwardOnly(), scrollSensitive() or scrollInsensitive()
for maximum driver compatibility.this, for convenient use as a chained builderpublic EntityFindOptions distinct()
setDistinct(true).this, for convenient use as a chained builderpublic EntityFindOptions maxResults(int maxResults)
setMaxResults(int).this, for convenient use as a chained builderpublic EntityFindOptions fetchSize(int fetchSize)
setFetchSize(int).this, for convenient use as a chained builderpublic EntityFindOptions range(int offset, int maxResults)
offset - the offset from which to startmaxResults - the maximum number of results to findthis, for convenient use as a chained builderCopyright © 2015 Atlassian. All rights reserved.