How to create a boolean datatype in AWS DynamoDB Read/Write operations using DynamoDB table annotations

1.2k views Asked by At

I have created a class pojo class in java to create/update items in aws dynamodb when i was trying to create/update an item in dynamodb it is working fine but the column created in dynamodb datatype seems to be string instead of boolean. I have tried below annotations but whenever row created datatype seems to be string instead of boolean.

@DynamoDBConvertedBool(value = Format.true_false)
@DynamoDBConvertedBool(DynamoDBConvertedBool.Format.true_false)

DynamoDb class.java

@DynamoDBConvertedBool(value = Format.true_false)
public boolean isDailyconsolidated() {
    return dailyconsolidated;
}

public void setDailyconsolidated(boolean dailyconsolidated) {
    this.dailyconsolidated = dailyconsolidated;
}

@DynamoDBConvertedBool(DynamoDBConvertedBool.Format.true_false)
public boolean isDailyindividual() {
    return dailyindividual;
}

public void setDailyindividual(boolean dailyindividual) {
    this.dailyindividual = dailyindividual;
}

I have given the annotations used and sample attributes used in my class file for reference.

1

There are 1 answers

0
Traycho Ivanov On BEST ANSWER

Have you tried using @DynamoDBTyped annotation ?

@DynamoDBTyped(DynamoDBAttributeType.BOOL)