L'entità che sto interrogando ha un & a RangeKey
(numero). Quando uso batchGetItem
su di esso, ottengo il seguente errore:Errore nell'API batchGetItem in java
AWS Error Code: ValidationException, AWS Error Message: One or more parameter values were invalid: Mismatching attribute types between location and schema
schema:
Table: Daily
Hash Key: CustId (String)
Range Key: Dated (Number)
dati:
CustId : VisioNerdy
Dated : 1329071400000
Codice:
List<Key> fkeys = new ArrayList<Key>(); //tableName="Daily", keys=["VisioNerdy"], ranges=[1329071400000] Map<String, KeysAndAttributes> requestItems = new HashMap<String, KeysAndAttributes>(); for(int i = 0; i < keys.size(); i++) { String key = keys.get(i); if(ranges == null) fkeys.add(new Key().withHashKeyElement(new AttributeValue().withS(key))); else fkeys.add(new Key().withHashKeyElement(new AttributeValue().withS(key)) .withRangeKeyElement(new AttributeValue().withS(ranges.get(i).toString()))); } requestItems.put(tableName, new KeysAndAttributes().withKeys(fkeys)); BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest().withRequestItems(requestItems); BatchGetItemResult result = client.batchGetItem(batchGetItemRequest);
Degli indizi?
La prego di aggiungere il eventualmente condensato) schema (e il frammento di codice esegue la query per facilitare analisi? Grazie! –
Hai modificato la domanda per includerli. Grazie! –
Hai "if (ranges == null)" ma se una tabella ha una chiave di intervallo, è richiesto un valore; non puoi ometterlo –