Guest User

Untitled

a guest
Dec 8th, 2017
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. {
  2. "_embedded": {
  3. "users": [
  4. {
  5. "email": "some_email@gmail.com",
  6. "name": "some name",
  7. "id": "57420b2a0d31bb6cef4ee8e9"
  8. },
  9. {
  10. "email": "some_other_email@gmail.com",
  11. "name": "some other name",
  12. "id": "57420f340d31cd8a1f74a84e"
  13. }
  14. ]
  15. }
  16.  
  17. {
  18. "email": "some_other_email@gmail.com",
  19. "name": "some other name",
  20. "address": "1234 foo street"
  21. "gender": "female"
  22. "id": "57420f340d31cd8a1f74a84e"
  23. }
  24.  
  25. public class User {
  26.  
  27. private String id;
  28. private String email;
  29. private String address;
  30. private String name;
  31. private String gender;
  32.  
  33. ...
  34. }
  35.  
  36. @Projection(name="personSummary", types={Person.class})
  37. public interface PersonSummary {
  38. String getEmail();
  39. String getId();
  40. String getName();
  41. }
  42.  
  43. @RepositoryRestResource(excerptProjection = PersonSummary.class)
  44. public interface PersonRepository extends CrudRepository<Person, String> {}
  45.  
  46. public interface PersonRepository extends MongoRepository<Person, String>
  47.  
  48. @Query(value="{ 'firstname' : ?0 }", fields="{ 'firstname' : 1, 'lastname' : 1}")
  49. List<Person> findByThePersonsFirstname(String firstname);
  50.  
  51. }
Add Comment
Please, Sign In to add comment