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 -

Python Tornado package error when running server -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -