|
GemFire 6.0.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SelectResults<E>
Contains the results of a executing a
SELECT expression within a query. A SELECT
expression results in SelectResults that contain instances of
Struct if: (a) there is more than one projection in the projection
attributes, or (b) if the projection is * and there is more than
one collection specified in the FROM clause.
Otherwise, a SELECT expression over a collection of domain
objects results in SelectResults that contain domain objects,
i.e. instances of domain classes such as String or
Address.
Cache cache = ...
QueryService qs = cache.getQueryService();
String select = "SELECT DISTINCT * FROM /root/employees " +
"WHERE salary > 50000";
Query query = qs.newQuery(select);
SelectResults results = query.execute();
for (Iterator iter = results.iterator(); iter.hasNext(); ) {
Employee emp = (Employee) iter.next();
System.out.println("Highly compensated: " + emp);
}
select = "SELECT DISTINCT age, address.zipCode FROM /root/employees " +
"WHERE salary > 50000";
query = qs.newQuery(select);
results = query.execute();
for (Iterator iter = results.iterator(); iter.hasNext(); ) {
Struct struct = (Struct) iter.next();
int age = ((Integer) struct.get("age")).intValue();
String zipCode = (String) struct.get("zipCode");
System.out.println(age + " -> " + zipCode);
}
Query.execute()| Method Summary | |
|---|---|
List<E> |
asList()
Returns this SelectedResults as a
java.util.List. |
Set<E> |
asSet()
Returns this SelectResults as a
java.util.Set. |
CollectionType |
getCollectionType()
Return the ObjectType for the type of collection this represents. |
boolean |
isModifiable()
Return whether this collection is modifiable. |
int |
occurrences(E element)
Return the number of times element occurs in this collection, that is the number of duplicates element has in this collection as defined by
the equals> method. |
void |
setElementType(ObjectType elementType)
Specify a new elementType, overriding any existing known elementType. |
| Methods inherited from interface java.util.Collection |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Method Detail |
|---|
boolean isModifiable()
int occurrences(E element)
element has in this collection as defined by
the equals> method. If element is not present in this
collection, then 0 is returned.
element - the element
Set<E> asSet()
SelectResults as a
java.util.Set. If this collection is
distinct and unordered, then no copying is necessary. Otherwise, the
contents of this collection will be copied into a new instance of
java.util.HashSet.
java.util.Set?List<E> asList()
SelectedResults as a
java.util.List. If this collection is
ordered, then no copying is necessary. Otherwise, the
contents of this collection will be copied into a new instance of
java.util.ArrayList.
CollectionType getCollectionType()
void setElementType(ObjectType elementType)
elementType - the new elementType
|
GemFire 6.0.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||