当前位置: 首页>>代码示例>>Java>>正文


Java Query类代码示例

本文整理汇总了Java中com.datastax.driver.mapping.annotations.Query的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Query类属于com.datastax.driver.mapping.annotations包,在下文中一共展示了Query类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateSpecificGet

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
private static MethodSpec generateSpecificGet(TableMetadata table, ClassName entityTable, int desiredColumns) {
    String query = getBaseQuery(table) + " WHERE ";
    MethodSpec.Builder builder = MethodSpec.methodBuilder("getAll");

    List<ColumnMetadata> columns = table.getPrimaryKey();
    for(int i = 0; i < desiredColumns; i++) {
        ColumnMetadata column = columns.get(i);
        String name = column.getName();
        String newClause = name + "=:" + name;
        if(i != 0) {
            newClause = " AND " + newClause;
        }
        query += newClause;
        builder.addParameter(getSpec(column, true));
    }

    return builder.addModifiers(Modifier.ABSTRACT).addModifiers(Modifier.PUBLIC)
            .returns(ParameterizedTypeName.get(ClassName.get(ListenableFuture.class),
                    ParameterizedTypeName.get(ClassName.get(Result.class), entityTable)))
            .addAnnotation(AnnotationSpec.builder(Query.class).addMember("value", "$S", query).build())
            .build();

}
 
开发者ID:jtruelove,项目名称:exovert,代码行数:24,代码来源:AccessorGenerator.java

示例2: generateAll

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
private static MethodSpec generateAll(TableMetadata table, ClassName entityTable) {
    String query = getBaseQuery(table);

    return MethodSpec.methodBuilder("getAll")
            .addModifiers(Modifier.ABSTRACT).addModifiers(Modifier.PUBLIC)
            .returns(ParameterizedTypeName.get(ClassName.get(ListenableFuture.class),
                    ParameterizedTypeName.get(ClassName.get(Result.class), entityTable)))
            .addAnnotation(AnnotationSpec.builder(Query.class).addMember("value", "$S", query).build())
            .build();
}
 
开发者ID:jtruelove,项目名称:exovert,代码行数:11,代码来源:AccessorGenerator.java

示例3: addItemRefsToContainer

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("UPDATE content_v2 SET "
        + "item_refs = item_refs + :refs, "
        + "upcoming = upcoming + :upcoming, "
        + "available = available + :available "
        + "WHERE id = :id")
Statement addItemRefsToContainer(
        @Param("id") Long id,
        @Param("refs") Map<Ref, PartialItemRef> itemRefs,
        @Param("upcoming") Map<Ref, ItemRefAndBroadcastRefs> upcoming,
        @Param("available") Map<Ref, ItemRefAndLocationSummaries> available
);
 
开发者ID:atlasapi,项目名称:atlas-deer,代码行数:12,代码来源:ContentAccessor.java

示例4: removeItemRefsFromContainer

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("UPDATE content_v2 SET "
        + "item_refs = item_refs - :refs, "
        + "upcoming = upcoming - :upcoming, "
        + "available = available - :available "
        + "WHERE id = :id")
Statement removeItemRefsFromContainer(
        @Param("id") Long id,
        @Param("refs") Set<Ref> itemRefs,
        @Param("upcoming") Set<Ref> upcoming,
        @Param("available") Set<Ref> available
);
 
开发者ID:atlasapi,项目名称:atlas-deer,代码行数:12,代码来源:ContentAccessor.java

示例5: findAll

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + WordCount.CQL_KEYSPACE_NAME + "." + WordCount.CQL_TABLE_NAME + " limit :max")
Result<WordCount> findAll(@Param("max") int max);
 
开发者ID:mcfongtw,项目名称:flink-cassandra-connector-examples,代码行数:3,代码来源:WordCountAccessor.java

示例6: findAll

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + WikiEditRecord.CQL_KEYSPACE_NAME + "." + WikiEditRecord.CQL_TABLE_NAME + " limit :max")
Result<WikiEditRecord> findAll(@Param("max") int max);
 
开发者ID:mcfongtw,项目名称:flink-cassandra-connector-examples,代码行数:3,代码来源:WikiEditRecordAccessor.java

示例7: fetch

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + ObjectEntity.TABLE)
Result<ObjectEntity> fetch();
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:ObjectAccessor.java

示例8: getObjectByTypeValue

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + ObjectByTypeValueEntity.TABLE + " WHERE object_type_id = :type AND object_value = :value")
ObjectByTypeValueEntity getObjectByTypeValue(@Param("type") UUID objectTypeID, @Param("value") String objectValue);
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:ObjectAccessor.java

示例9: fetchObjectFactBindings

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + ObjectFactBindingEntity.TABLE + " WHERE object_id = :id")
Result<ObjectFactBindingEntity> fetchObjectFactBindings(@Param("id") UUID id);
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:ObjectAccessor.java

示例10: fetch

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + TABLE + " WHERE fact_id = :id")
Result<FactCommentEntity> fetch(@Param("id") UUID id);
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:FactCommentAccessor.java

示例11: fetchByValue

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + TABLE + " WHERE value = :value")
Result<FactEntity> fetchByValue(@Param("value") String value);
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:FactAccessor.java

示例12: refreshLastSeenTimestamp

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("UPDATE " + KEY_SPACE + "." + TABLE + " SET last_seen_timestamp = :timestamp WHERE id = :id")
void refreshLastSeenTimestamp(@Param("id") UUID id, @Param("timestamp") long timestamp);
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:FactAccessor.java

示例13: fetch

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + TABLE)
Result<ObjectTypeEntity> fetch();
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:ObjectTypeAccessor.java

示例14: getByName

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + TABLE + " WHERE name = :name")
ObjectTypeEntity getByName(@Param("name") String name);
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:ObjectTypeAccessor.java

示例15: fetch

import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + TABLE)
Result<FactTypeEntity> fetch();
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:3,代码来源:FactTypeAccessor.java


注:本文中的com.datastax.driver.mapping.annotations.Query类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。