JanVerbeke, your approach of either using a table alias or the actual tableName.field works. However, the challenging I am having is when I want to do this dynamically and my frontend doesn't have any idea of the tableName.fieldName but rather the fieldName only. I have a DTO object that contains all the fields I am exposing to the frontend which I want to use for sorting on both the frontend and the backend but due to nested associations I have, I can't get this to work.
Any suggestions will be appreciated.