我的课程如下
@DynamoDBTable(tableName = LogConstant.TableName)
public class Journal {
@DynamoDBIndexHashKey(attributeName = "event_type")
private String eventType;
@DynamoDBIndexHashKey(attributeName = "user_id",globalSecondaryIndexName = LogConstant.GlobalUserIdIndex)
private String userId;
@DynamoDBIndexHashKey(attributeName = "user_identifier", globalSecondaryIndexName = LogConstant.GlobalUserIdentifierIndex)
private String userIdentifier;
@DynamoDBIndexHashKey(attributeName = "order_id", globalSecondaryIndexName = LogConstant.GlobalOrderIdIndex)
private String orderId;
@DynamoDBTypeConvertedEnum
@DynamoDBAttribute(attributeName = "generated_by")
private GenertionType generatedBy;
@DynamoDBTypeConvertedEnum
@DynamoDBHashKey(attributeName = "interacting_service")
private InteractingService interactingSerice;
@DynamoDBAttribute(attributeName = "agent")
private String agent;
@DynamoDBAttribute(attributeName = "content")
private String content;
@DynamoDBRangeKey
@DynamoDBIndexRangeKey(attributeName = "created_at",
globalSecondaryIndexNames = {LogConstant.GlobalUserIdIndex,LogConstant.GlobalUserIdentifierIndex,LogConstant.GlobalOrderIdIndex})
private String createdAt;
获取搜索结果的服务是
DynamoDBQueryExpression<Journal> expression = new
DynamoDBQueryExpression<Journal>()
.withIndexName(LogConstant.GlobalUserIdIndex)
.withConsistentRead(false)
.withHashKeyValues(journal);
TableDescription table = DynamoDbStarter.getDynamoDB().getTable(LogConstant.TableName).describe();
return DynamoDbStarter.getDynamoDBMapper().query(Journal.class, expression);
即使插入工作正常但在获取结果期间我收到异常
我有一个哈希键作为interacting_service 和范围键作为CreatedDate 的表。我正在尝试通过 GSI 获取结果 但不知何故它导致了异常 有人可以看到我做错了什么吗
心有法竹
肥皂起泡泡
相关分类