Guest User

Untitled

a guest
Feb 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. public interface PersonRepository extends MongoRepository<Person, String> {
  2. Person findByName(String name);
  3. }
  4.  
  5. public interface PhonebookRepository extends MongoRepository<Phonebook, String> {
  6.  
  7. Phonebook findByNumer(String numer);
  8. Phonebook deleteByNumer(String numer);
  9. }
  10.  
  11. @Document(collection = "Person")
  12. public class Person {
  13. @Id
  14. private String id;
  15.  
  16. private String name;
  17. private String email;
  18. private String password;
  19. private String old;
  20.  
  21. public Person(String name, String password) {
  22. this.name = name;
  23. this.email = email;
  24. this.password = password;
  25. this.old = old;
  26. }
  27.  
  28. @Document(collection = "Phonebook")
  29. public class Phonebook {
  30. @Id
  31. private String id;
  32.  
  33. private String date;
  34. private String numer;
  35. private String name;
  36. private String info;
  37.  
  38. public Phonebook(String numer) {
  39. this.date = date;
  40. this.numer = numer;
  41. this.name = name;
  42. this.info = info;
  43. }
Add Comment
Please, Sign In to add comment