Differences between Datamanager and jpql with views

Hi good morning, I have doubts in the use of consultations on the database:

  1. Differences between Datamanager and consultations JPQL ?, which is better used in services ?, in controllers?
  2. Both Datamanager and JPQL can add “views” to the consultations, which have effect on the information to return?, for example. if a query JPQL already indicated the type of fetch for returning related entities, I need apply the view?, or the view only applies when the fetch is not used in queries ?.
    It would be nice to have some document or example in which the differences are seen.
    Greetings and thanks.

Perhaps you mean the difference between DataManager and Query obtained from EntityManager.

First, please look at this topic: DataManager and EntityManager - CUBA.Platform. We will create a detailed description of differences between DataManager and EntityManager in the documentation shortly after releasing the next platform version (6.2), because it will add something to the subject.

Regarding views, they ensure loading of the specified attributes. You don’t need to define “fetch joins” in your queries.