I have Company object and
@OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, mappedBy = "company")
@Column(nullable = false)
Set<User> getUsers()
Do you recommend caching the getUsers collection performance wise?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on how frequently the
getUsers()method is being called by the users/user of your app. If at the momentgetUsers()is not causing a noticeable performance degradation in your app you can leave it as is. Otherwise you might consider making it cacheable and compare its impact on the performance of your app. Sometime caching can degrade performance of an app when you don’t have enough memory allocated to your Java process (e.g Tomcat.)