java.lang.Object | |
↳ | com.atlassian.jira.entity.Select |
Select is the entry point to building up a SelectQuery
which can be run in OfBiz Entity Engine.
SelectQuery<GenericValue> query = Select.columns().from("FilterSubscription") .whereEqual("group", (String) null) .andEqual("username", username) .orderBy("id desc");If you are selecting a single column, then you can it can return String objects instead of GenericValues like
SelectQuery<String> query = Select.distinctString("username").from("FilterSubscription"); List<String> vals = query.runWith(delegator).asList();You can also use an
EntityFactory
to automatically convert the GenericValues to other entity objects.
List<ProjectCategory> categories = Select.from(Entity.PROJECT_CATEGORY).runWith(delegator).asList();
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Select.ExecutableContext<E> | Partially constructed query that has enough information supplied to form a complete query. | ||||||||||
Select.LimitContext<E> | A fully specified query that is ready to be executed. | ||||||||||
Select.OrderByContext<E> | A partially constructed query with completed column, entity, where condition, and ordering information already specified. | ||||||||||
Select.SelectColumnsContext | Partially constructed query that has a column list but no entity name, yet. | ||||||||||
Select.SelectColumnsFromContext<E> | A partially constructed query that may accept .where and .orderBy clauses. |
||||||||||
Select.SelectSingleColumnContext<E> | Partially constructed query that has a column list (with a single target column) but no entity name, yet. | ||||||||||
Select.WhereClauseAwareContext<E> | Marker for contexts that can accept a where clause. | ||||||||||
Select.WhereContext<E> | A partially constructed query that may accept .where and .orderBy clauses. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Begins a
SELECT query that will only retrieve the specified columns. | |||||||||||
Begins a
SELECT query that will only retrieve the specified columns. | |||||||||||
Builds a "SELECT COUNT(*) FROM ..." query for the given entity.
| |||||||||||
Begins a
SELECT DISTICT query that will only retrieve the specified columns. | |||||||||||
Begins a
SELECT DISTICT query that will only retrieve the specified String column. | |||||||||||
Begins a
SELECT * query for the specified entity. | |||||||||||
Begins a
SELECT * query for the specified entity factory. | |||||||||||
Begins a
SELECT query that will only retrieve the "id" field, which must use Long
values. | |||||||||||
Begins a
SELECT query that will only retrieve the specified String column. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Begins a SELECT
query that will only retrieve the specified columns.
columns | the list of fields to retrieve; must not be null or contain any null values |
---|
.from(entityName)
to continue building it
Begins a SELECT
query that will only retrieve the specified columns.
columns | the fields to retrieve; must not be null or contain any null values |
---|
.from(entityName)
to continue building it
Builds a "SELECT COUNT(*) FROM ..." query for the given entity.
For example:
long count = Select.countFrom(Entity.Name.COMMENT)
.whereEqual("author", userKey)
.runWith(ofBizDelegator)
.singleValue();
This method requires the existence of a "Count"
view in the entity model, which has not been defined
for all entities. Consider building a normal query with .count()
as the finishing action for a more flexible alternative.
entityName | the Entity |
---|
Begins a SELECT DISTICT
query that will only retrieve the specified columns.
columns | the fields to retrieve; must not be null or contain any null values |
---|
.from(entityName)
to continue building it
Begins a SELECT DISTICT
query that will only retrieve the specified String
column.
columnName | the field to query |
---|
.from(entityName)
to continue building it
Begins a SELECT *
query for the specified entity.
entityName | the name of the entity to query |
---|
.where...
constraints, an orderBy
,
or a .runWith
method to continue building it
Begins a SELECT *
query for the specified entity factory.
As the query returns results, build(GenericValue)
is used on each
value to yield its corresponding entity value.
entityFactory | the entity factory to use for coverting GenericValue to the
desired return type |
---|
.where...
constraints, an orderBy
,
or a .runWith
method to continue building it
Begins a SELECT
query that will only retrieve the "id"
field, which must use Long
values.
WARNING: Not suitable for use with "id"
columns that return a String
, such as
those used for issue constants.
.from(entityName)
to continue building it
Begins a SELECT
query that will only retrieve the specified String
column.
columnName | the field to query |
---|
.from(entityName)
to continue building it