title: How can I use Java Enums with Amazon DynamoDB and AWS SDK v2?
body: <p>I am trying to implement a simple java event-handler lambda for AWS. It receives sqs events and should make appropriate updates to the dynamoDB table.</p>
  <p>One of the attributes in this table is a status field that has 4 defined states; therefore I wanted to use an enum class in java and map it to this attribute.</p>
  <p>Under AWS SDK v1 I could use the @DynamoDBTypeConvertedEnum annotation. But it does not exist anymore in v2. Instead, there is the @DynamoDbConvertedBy() which receives a converter class reference. There is also an EnumAttributeConverter class which should work nicely with it.</p>
  <p>But for some reason, it does not work. The following is a snip from my current code:</p>
  <pre class="lang-java prettyprint-override"><code>@Data
  @DynamoDbBean
  @NoArgsConstructor
  public class Task{
  
  @Getter(onMethod_ = {@DynamoDbPartitionKey})  
      String id; 
  
  ...
  
  @Getter(onMethod_ = {@DynamoDbConvertedBy(EnumAttributeConverter.class)})
      ExportTaskStatus status;
  }
  </code></pre>
  <p>The enum looks as follows:</p>
  <pre class="lang-java prettyprint-override"><code>@RequiredArgsConstructor
  public enum TaskStatus {
      @JsonProperty(&quot;running&quot;) PROCESSING(1),
      @JsonProperty(&quot;succeeded&quot;) COMPLETED(2),
      @JsonProperty(&quot;cancelled&quot;) CANCELED(3),
      @JsonProperty(&quot;failed&quot;) FAILED(4);
  
      private final int order;
  }
  </code></pre>
  <p>With this, I get the following exception when launching the application:</p>
  <pre><code>Class 'class software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.EnumAttributeConverter' appears to have no default constructor thus cannot be used with the BeanTableSchema
  </code></pre>