aws / aws/aws-sdk-java-v2

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

Offen
#7,328 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug dynamodb-enhanced p2
Vorherrschende Sprache
Java
Sterne
2.6k
Forks
1k
Ø Merge
2 T. 9 Std.
Gemergte PRs (30 T.)
51

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne im Bean- und Property-Mapping-Code des AWS SDK v2 Enhanced Client, mit Fokus auf JavaBeans-Introspektion und darauf, wie @DynamoDbIgnore angewendet wird. Reproduziere das Problem mit der bereitgestellten Foo-Klasse in Version 2.51.3; abgeschlossen ist die Aufgabe, wenn getA()/setA(int) das Attribut A abbildet, während die annotierte isA() ignoriert wird und ein Regressionstest dieses Szenario abdeckt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
databases
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.