List of usage examples for com.amazonaws.services.dynamodbv2.model GetItemRequest setProjectionExpression
public void setProjectionExpression(String projectionExpression)
A string that identifies one or more attributes to retrieve from the table.
From source file:org.iternine.jeppetto.dao.dynamodb.DynamoDBQueryModelDAO.java
License:Apache License
@Override public T findById(ID id) throws NoSuchItemException, JeppettoException { GetItemResult result;/* w w w. j a v a 2s.c o m*/ try { GetItemRequest getItemRequest = new GetItemRequest(tableName, getKeyFrom(id), consistentRead); getItemRequest.setProjectionExpression(projectionExpression); if (!projectionExpressionNames.isEmpty()) { getItemRequest.setExpressionAttributeNames(projectionExpressionNames); } result = dynamoDB.getItem(getItemRequest); } catch (AmazonClientException e) { throw new JeppettoException(e); } if (result.getItem() == null) { throw new NoSuchItemException(entityClass.getSimpleName(), id.toString()); } T t = ConversionUtil.getObjectFromItem(result.getItem(), entityClass); ((DynamoDBPersistable) t).__markPersisted(dynamoDB.toString()); return t; }