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
Post a Comment