我有一个方法,它只是为特定记录存储标志值true.我的标志属性已定义为布尔值,其在DynamoDB数据库中的值为true/false.在运行此方法时,不管是否存储true值,它都会为flag属性插入一个新列作为number数据类型并写入值1而不是true.在调试时,我可以看到它正在读取值为"true",但在编写我的猜测时,它为1表示true,0表示false,因此写入1.
public static ArrayList<UserWishListBuks> removeNotification(int Statusid) {
AmazonDynamoDBClient ddb = NavigationDrawerActivity.clientManager
.ddb();
DynamoDBMapper mapper = new DynamoDBMapper(ddb);
DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
Boolean value = true;
try{
PaginatedScanList<UserWishListBuks> result = mapper.scan(
UserWishListBuks.class, scanExpression);
for (UserWishListBuks bre : result) {
if( (bre.getBOOK_STATUS_ID()==(Statusid)) )
{
bre.setNOTIFICATION_FLAG(true);
mapper.save(bre);
}
}
}catch (AmazonServiceException ex) {
NavigationDrawerActivity.clientManager
.wipeCredentialsOnAuthError(ex);
}
return null;
}
Run Code Online (Sandbox Code Playgroud)