org.apache.ignite.cache

## Class QueryEntity

- java.lang.Object
- - org.apache.ignite.cache.QueryEntity

All Implemented Interfaces:
  Serializable

    public class QueryEntity
    extends Object
    implements Serializable

Query entity is a description of `cache` entry (composed of key and value) in a way of how it must be indexed and can be queried.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`QueryEntity()`

### Method Summary

Methods
`void` `addQueryField(String fullName, String type, String alias)` Utility method for building query entities programmatically.
`static String` `defaultIndexName(QueryIndex idx)` Generates default index name by concatenating all index field names.
`void` `ensureIndex(String idxName, QueryIndexType idxType)` Ensures that index with the given name exists.
`Map<String,String>` `getAliases()` Gets aliases map.
`LinkedHashMap<String,String>` `getFields()` Gets query fields for this query pair.
`Collection<QueryIndex>` `getIndexes()` Gets a collection of index entities.
`String` `getKeyType()` Gets key type for this query pair.
`String` `getValueType()` Gets value type for this query pair.
`void` `setAliases(Map<String,String> aliases)` Sets mapping from full property name in dot notation to an alias that will be used as SQL column name.
`void` `setFields(LinkedHashMap<String,String> fields)` Sets query fields for this query pair.
`void` `setIndexes(Collection<QueryIndex> idxs)` Sets a collection of index entities.
`void` `setKeyType(String keyType)` Sets key type for this query pair.
`void` `setValueType(String valType)` Sets value type for this query pair.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### QueryEntity

    public QueryEntity()

### Method Detail

#### getKeyType

    public String getKeyType()

Gets key type for this query pair.

Returns:
  Key type.

#### setKeyType

    public void setKeyType(String keyType)

Sets key type for this query pair.

Parameters:
  `keyType` - Key type.

#### getValueType

    public String getValueType()

Gets value type for this query pair.

Returns:
  Value type.

#### setValueType

    public void setValueType(String valType)

Sets value type for this query pair.

Parameters:
  `valType` - Value type.

#### getFields

    public LinkedHashMap<String,String> getFields()

Gets query fields for this query pair. The order of fields is important as it defines the order of columns returned by the 'select *' queries.

Returns:
  Field-to-type map.

#### setFields

    public void setFields(LinkedHashMap<String,String> fields)

Sets query fields for this query pair. The order if fields is important as it defines the order of columns returned by the 'select *' queries.

Parameters:
  `fields` - Field-to-type map.

#### getIndexes

    public Collection<QueryIndex> getIndexes()

Gets a collection of index entities.

Returns:
  Collection of index entities.

#### getAliases

    public Map<String,String> getAliases()

Gets aliases map.

Returns:
  Aliases.

#### setAliases

    public void setAliases(Map<String,String> aliases)

Sets mapping from full property name in dot notation to an alias that will be used as SQL column name. Example: {"parent.name" -> "parentName"}.

Parameters:
  `aliases` - Aliases map.

#### setIndexes

    public void setIndexes(Collection<QueryIndex> idxs)

Sets a collection of index entities.

Parameters:
  `idxs` - Collection of index entities.

#### addQueryField

    public void addQueryField(String fullName,
                     String type,
                     String alias)

Utility method for building query entities programmatically.

#### ensureIndex

    public void ensureIndex(String idxName,
                   QueryIndexType idxType)

Ensures that index with the given name exists.

Parameters:
  `idxName` - Index name.
  `idxType` - Index type.

#### defaultIndexName

    public static String defaultIndexName(QueryIndex idx)

Generates default index name by concatenating all index field names.

Parameters:
  `idx` - Index to build name for.
Returns:
  Index name.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.6.0
Release Date | : May 18 2016