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

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

php - Cannot override Laravel Spark authentication with own implementation -

What is happening when Matlab is starting a "parallel pool"? -