Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "_embedded": {
- "users": [
- {
- "email": "some_email@gmail.com",
- "name": "some name",
- "id": "57420b2a0d31bb6cef4ee8e9"
- },
- {
- "email": "some_other_email@gmail.com",
- "name": "some other name",
- "id": "57420f340d31cd8a1f74a84e"
- }
- ]
- }
- {
- "email": "some_other_email@gmail.com",
- "name": "some other name",
- "address": "1234 foo street"
- "gender": "female"
- "id": "57420f340d31cd8a1f74a84e"
- }
- public class User {
- private String id;
- private String email;
- private String address;
- private String name;
- private String gender;
- ...
- }
- @Projection(name="personSummary", types={Person.class})
- public interface PersonSummary {
- String getEmail();
- String getId();
- String getName();
- }
- @RepositoryRestResource(excerptProjection = PersonSummary.class)
- public interface PersonRepository extends CrudRepository<Person, String> {}
- public interface PersonRepository extends MongoRepository<Person, String>
- @Query(value="{ 'firstname' : ?0 }", fields="{ 'firstname' : 1, 'lastname' : 1}")
- List<Person> findByThePersonsFirstname(String firstname);
- }
Add Comment
Please, Sign In to add comment