sonarqube - "Mutable members should not be stored or returned directly"- private Set<User> users; -


i using hibernate pojo classes relationship. how can write setter & getter method of private set users; when doing this

@onetomany(fetch = fetchtype.lazy, mappedby = "timezone") public set<userdto> getusers() {     return this.users; }  public void setusers(set<userdto> users) {     set<userdto> userdtocopy=new hashset<>(users);     this.users = userdtocopy; 

// this.users = users; } works fine fetch child class records well. eager loading. don't want this. there way write setter method set


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -