Annotation Type QuerySqlField


  • @Documented
    @Retention(RUNTIME)
    @Target(FIELD)
    public @interface QuerySqlField
    Annotates fields for SQL queries. All fields that will be involved in SQL clauses must have this annotation. For more information about cache queries see CacheQuery documentation.
    See Also:
    CacheQuery
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean descending
      Specifies whether index should be in descending order or not.
      String[] groups
      Array of index groups this field belongs to.
      boolean index
      Specifies whether cache should maintain an index for this field or not.
      int inlineSize
      Index inline size in bytes.
      String name
      Property name.
      boolean notNull
      Specifies whether the specified field can be null.
      QuerySqlField.Group[] orderedGroups
      Array of ordered index groups this field belongs to.
      int precision
      Specifies field precision for variable length types - decimal, string and byte array.
      int scale
      Specifies scale for a decimal field.
    • Element Detail

      • index

        boolean index
        Specifies whether cache should maintain an index for this field or not. Just like with databases, field indexing may require additional overhead during updates, but makes select operations faster.

        When indexing SPI and indexed field is of type org.locationtech.jts.geom.Geometry (or any subclass of this class) then Ignite will consider this index as spatial providing performance boost for spatial queries.

        Returns:
        True if index must be created for this field in database.
        Default:
        false
      • descending

        boolean descending
        Specifies whether index should be in descending order or not. This property only makes sense if index() property is set to true.
        Returns:
        True if field index should be in descending order.
        Default:
        false
      • notNull

        boolean notNull
        Specifies whether the specified field can be null.
        Returns:
        True if the field is not allowed to accept null values.
        Default:
        false
      • precision

        int precision
        Specifies field precision for variable length types - decimal, string and byte array.
        Returns:
        field precision for variable length types - decimal, string and byte array.
        Default:
        -1
      • scale

        int scale
        Specifies scale for a decimal field.
        Returns:
        scale for a decimal field.
        Default:
        -1
      • groups

        String[] groups
        Array of index groups this field belongs to. Groups are used for compound indexes, whenever index should be created on more than one field. All fields within the same group will belong to the same index.

        Group indexes are needed because SQL engine can utilize only one index per table occurrence in a query. For example if we have two separate indexes on fields a and b of type X then query select * from X where a = ? and b = ? will use for filtering either index on field a or b but not both. For more effective query execution here it is preferable to have a single group index on both fields.

        For more complex scenarios please refer to QuerySqlField.Group documentation.

        Returns:
        Array of group names.
        Default:
        {}
      • orderedGroups

        QuerySqlField.Group[] orderedGroups
        Array of ordered index groups this field belongs to. For more information please refer to QuerySqlField.Group documentation.
        Returns:
        Array of ordered group indexes.
        See Also:
        groups()
        Default:
        {}
      • name

        String name
        Property name. If not provided then field name will be used.
        Returns:
        Name of property.
        Default:
        ""
      • inlineSize

        int inlineSize
        Index inline size in bytes. When enabled part of indexed value will be placed directly to index pages, thus minimizing data page accesses, thus incraesing query performance.

        Allowed values:

        • -1 (default) - determine inline size automatically (see below)
        • 0 - index inline is disabled (not recommended)
        • positive value - fixed index inline
        When set to -1, Ignite will try to detect inline size automatically. It will be no more than CacheConfiguration.getSqlIndexMaxInlineSize(). Index inline will be enabled for all fixed-length types, but will not be enabled for String.

        When index group is used, inline size must be defined in QueryGroupIndex.inlineSize(). Any value except of -1 defined on a specific column will lead to exception.

        Returns:
        Index inline size in bytes.
        Default:
        -1