aws / aws/aws-sdk-java-v2

DynamoDB Enhanced Client Polymorphic Types

Aperta
#1,870 25 commenti 53 reazioni 0 assegnatari Vedi su GitHub
dynamodb-enhanced feature-request p1
Lingua principale
Java
Stelle
2.6k
Fork
1k
Merge medio
2g 9h
PR unite (30g)
51

Descrizione

We should support reading/writing base types using the DynamoDB Enhanced Client.

Potential syntax/example (not yet implemented):

```java
@DynamoDbBean
@DynamoDbSubtypes({Employee.class, Customer.class})
public abstract class Person {
@DynamoDBHashKey
private long id;
private String name;
}

@DynamoDbBean
private class Employee extends Person {
}

@DynamoDbBean
private class Customer extends Person {
}

DynamoDbEnhancedClient client = DynamoDbEnhancedClient.create();
DynamoDbTable people = client.table("people", TableSchema.fromBean(Person.class));

Employee bob = new Employee();
bob.setId(1);
bob.setName("Bob the Builder");

Customer lfh = new Customer();
lfh.setId(2);
lfh.setName("Low Flying Hawk");

people.putItem(bob);
people.putItem(lfh);

assertThat(people.getItem(Key.builder().partitionValue(1).build())).isInstanceOf(Employee.class);
assertThat(people.getItem(Key.builder().partitionValue(2).build())).isInstanceOf(Customer.class);
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

The issue names DynamoDbEnhancedClient.table, TableSchema.fromBean, and DynamoDbTable but no repository files or tests. Start by tracing how TableSchema.fromBean maps the base type, then design coverage for the Employee and Customer round trip shown. Done means base-typed reads return the correct concrete subtype and both subtype writes remain readable.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, java
Ambito
databases
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.