I have this method and if someone wants to connect I can hop on a call as well, but overall I'm trying to delete a book from the table and here is the code I wrote so far. IntelliJ is saying the .put method for the Hashmap might result in a NullPointer but I have no idea how to prevent it.
''JAVA
public boolean deleteBook(String bookId) {
Book book = new Book(Book.builder());
book.setBookId(bookId);
DynamoDBDeleteExpression deleteExpression = new DynamoDBDeleteExpression();
Map <String, ExpectedAttributeValue> expectedAttributeValueMap = new HashMap<>();
expectedAttributeValueMap.put("isActive",
new ExpectedAttributeValue()).
withValue(new AttributeValue().withBOOL(false));
deleteExpression.setExpected(expectedAttributeValueMap);
try {
dynamoDbMapper.delete(book, deleteExpression);
return true;
} catch (ConditionalCheckFailedException e) {
System.out.println(e);
return false;
}
}
""