I have a project which has a dashboard page. within that dashboard page, I have to show :
Now each of the above info are related to different tables within my database.
I have created different Entities and I'm using hibernate. Suppose client-A opens his dashboard, I should execute multiple queries for gathering all the info from all of those entities. Here are the challenges:
I was thinking the best approach for having an efficient and fast output is to create one Big Native query and get all data at once with a Single query BUT if I'm gonna do this, I have to write native query and map everything by myself which makes the sole of using hibernate faint.
The other approach I'm thinking is to use executor service and multi-threading in my application
Now my question is, what is the best approach that I still can use hibernate mapping and issue high performance query ?
Thank you in advance
Your problem seems to stem from the notion that you believe you need to gather all the information for your dashboard in one controller call in order to render a single page. What you should do is take a step back and try to componentize your dashboard.
In other words, what I mean is take advantage of the asynchronous nature of Ajax.
There really is not a reason to use an executor service with today's modern browser tech when the browser can handle initiating multiple web requests asynchronously to render a single web page.