forked from michaellavelle/spring-data-dynamodb
-
Notifications
You must be signed in to change notification settings - Fork 141
Projections
Sebastian J edited this page Mar 22, 2018
·
3 revisions
Projections are supported by the @Query
annotation via DynamoDB's Projection Expressions
To use a projection, the @Query
annotation must be added to the Repository interface and the desired fields must be provided (comma separated):
import org.socialsignin.spring.data.dynamodb.repository.Query;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface UserRepository extends CrudRepository<User, String> {
@Query(fields = "leaveDate")
List<User> findByPostCode(String postCode);
All attributes that are not specified in the fields
list will be null
- this includes the hash/range key attributes!
Note:
- If projections are used on Global Secondary Indexes, the index must contain the desired fields in the first place (either by
SELECT
ed attributes or viaALL
) - This feature is available since version
5.0.3