SHARE
TWEET

Untitled

a guest Oct 21st, 2019 73 in 3 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. {                             | How does the POST should work and look?
  3.         "id":7,               | Should ID be passed?
  4.         "number":"1231321",   |
  5.         "details":{           | How to deal with nested object? If both Root and Nested object
  6.             "id":"10",        | do not exist then create both / throw error for nested /
  7.             "provider":"Ford" | first create nested in other request then assign Root to nested by ID?
  8.             }                 | others?...
  9. }    
  10.  */
  11.  
  12. public class Phone {
  13.     @Id
  14.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  15.     private Long id;
  16.     private String number;
  17.     @OneToOne(mappedBy = "phone", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
  18.     private PhoneDetails phoneDetails;
  19. }
  20.  
  21.  
  22. public class PhoneDetails {
  23.  
  24.     @Id
  25.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  26.     private Long id;
  27.     private String provider;
  28.     @OneToOne(fetch = FetchType.LAZY)
  29.     @JoinColumn(name = "phone_id")
  30.     private Phone phone;
  31.  
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top