aws / aws/aws-sdk-java-v2

DynamoDB Enhanced Client: @DynamoDbIgnore fails in some property mapping scenarios

Open
#7,328 2 comments 0 reactions 0 assignees View on GitHub
bug dynamodb-enhanced p2
Dominant language
Java
Stars
2.6k
Forks
1k
Avg merge
2d 9h
Merged PRs (30d)
51

Description

### Describe the bug

The DynamoDB Enhanced Client fails to recognize a valid setter when a bean has both `getA()` and `isA()` methods, even when `isA()` is annotated with `@DynamoDbIgnore`.

### Regression Issue

- [x] Select this option if this issue appears to be a regression.

### Expected Behavior

`a` should be mapped using:

```text
getA(): int
setA(int): void
```

and `isA()` should be ignored because of `@DynamoDbIgnore`.

### Current Behavior

The `setA(int)` setter is not recognized, and the `a` attribute is not mapped correctly.

This appears to be caused by the interaction between JavaBeans property introspection and the two getters:

```text
getA(): int
isA(): boolean
```

Even though `isA()` is annotated with `@DynamoDbIgnore`, it still affects property discovery.

### Reproduction Steps

```java
@DynamoDbBean
public class Foo {
private int a;

@DynamoDbAttribute("A")
public int getA() {
return a;
}

public void setA(int a) {
this.a = a;
}

@DynamoDbIgnore
public boolean isA() {
return false;
}
}
```

### Possible Solution

_No response_

### Additional Information/Context

The same class is mapped correctly by the AWS SDK for Java v1, which does not rely on the same JavaBeans property conventions as the v2 Enhanced Client.

### AWS Java SDK version used

2.51.3

### JDK version used

11.0.32.1

### Operating System and version

Windows 11

Contributor guide

Open the contributing guide

Research direction

Start in the AWS SDK v2 Enhanced Client bean and property-mapping code, focusing on JavaBeans introspection and how @DynamoDbIgnore is applied. Reproduce the issue with the supplied Foo class on version 2.51.3; done means getA()/setA(int) maps attribute A while the annotated isA() is ignored, with a regression test covering the scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.