本文整理汇总了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();
}
示例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();
}
示例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
);
示例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
);
示例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);
示例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);
示例7: fetch
import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + ObjectEntity.TABLE)
Result<ObjectEntity> fetch();
示例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);
示例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);
示例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);
示例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);
示例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);
示例13: fetch
import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + TABLE)
Result<ObjectTypeEntity> fetch();
示例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);
示例15: fetch
import com.datastax.driver.mapping.annotations.Query; //导入依赖的package包/类
@Query("SELECT * FROM " + KEY_SPACE + "." + TABLE)
Result<FactTypeEntity> fetch();