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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -