Skip to content
Advertisement

Multiple queries in the same view

I would like to run multiple queries then show results in a page such as : https://adminlte.io/themes/v3/index.html

I create a first controller query :

Can you telling me how to run multiple and optimized queries in the same time for my page full of dashboards, charts and tables!

If i create multiple list of ebeanLists ( queries ), does this will affect the loading of my page ? IF not, then, what should i do ?

Thank you in advance,

Advertisement

Answer

Typically, in an application similar to the link you have provided, you create reusable APIs following the MVC design pattern. Querying the database from the controller is very much against that pattern.

Each API should be atomic, creating a single API to run 1 query to fetch all of the data for that page is not the correct approach.

If you are looking for performance for your API you should get familiar with asynchronous programming. Running your APIs async will allow your back end to process multiple front end requests at the same time, greatly improving performance.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement