Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. @Override
  2. @Query(value = "select u from User u where u.region in :#{principal.region}")
  3. Page<User> findAll(Pageable var1);
  4.  
  5. @ManyToMany( mappedBy = "users")
  6. private List<Region> region = new ArrayList<>();
  7.  
  8. @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
  9. @JoinTable(name = "region_users", joinColumns = @JoinColumn(name = "region_id", referencedColumnName= "id"),
  10. inverseJoinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id")
  11. )
  12. private List<User> users = new ArrayList<>();
  13.  
  14. private List<Region> region;
  15.  
  16. public UserPrincipal(Long id, String username, String password,
  17. Collection<? extends GrantedAuthority> authorities, Role role, List<Region> region) {
  18. this.id = id;
  19. this.username = username;
  20. this.password = password;
  21. this.authorities = authorities;
  22. this.role = role;
  23. this.region = region;
  24. }
  25.  
  26. public List<Region> getRegion() { return this.region; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement