3.2. ProtoStream 共通タイプのクエリー


BigIntegerBigDecimal などの ProtoStream 共通タイプとしてデータを保存するキャッシュで Ickle クエリーを実行します。

手順

  1. 次の例のように、インデックスアノテーションをクラスに追加します。

    @Indexed
    public class CalculusIndexed {
        @Basic
        @ProtoField(value = 1)
        public BigInteger getPurchases() {
          return purchases;
        }
    
        @Decimal // the scale is 2 by default
        @ProtoField(value = 2)
        public BigDecimal getProspect() {
          return prospect;
        }
    }
    Copy to Clipboard Toggle word wrap
  2. dependOn 属性を CommonTypes.class に設定して、生成された Protobuf スキーマが BigIntegerBigDecimal などの CommonTypes 型を参照および使用できることを示します。

    @AutoProtoSchemaBuilder(includeClasses = CalculusIndexed.class, dependsOn = CommonTypes.class,
         schemaFilePath = "/protostream", schemaFileName = "calculus-indexed.proto",
         schemaPackageName = "lab.indexed")
    public interface CalculusIndexedSchema extends GeneratedSchema {
    }
    Copy to Clipboard Toggle word wrap
  3. クエリーを実行します。

    Query<Product> query = queryFactory.create("from lab.indexed.CalculusIndexed c where c.purchases > 9");
    QueryResult<Product> result = query.execute();
    // play with the result
    
    query = queryFactory.create("from lab.indexed.CalculusIndexed c where c.prospect = 2.2");
    result = query.execute();
    // play with the result
    Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る