we have to manage millions db rows and we have created a couple of screens with some filter criteria already definited for the users.
In case of criteria related to an entity, the default components used by the filter are lookup fields that load all data making the loading of the screen very slow.
First issue: How can we change the type of the component in the filter? For example: choose a lookup field in case of a criterion with a number of related entities less than 50 and a pickerfield for a criterion with a number of related entities more than 50.
Moreover, in case of a filter with 15 entity criteria, if the user doesn’t set any filter and presses the search button, the application is really slow. That’s because the filter performs the query with 137 table joins anyway (we logged the sql that the filter component generates when it is loaded).
Second issue: Is it possible to create the query with the only setted criteria reducing the number of table joins? This could really improve the performance of the application.
Is there any way to retrieve the jpql query generate by the filter to manipulate it and its filter criteria before to be applied?
Last question: We noticed that the constructor of the EntityManagerImpl class doesn’t have an access modifier therefore it is not possible to extends it eventually. Is it intentional?