Filter attributes with one-to-many using datamanager

Is there a way to filter on an attribute that has a one to many relationship using the data manager?Entity Person has a attribute named assignments which is linked to Entity Assignment where one person has one or more assignments. Can you include the assigments attribute in a query statement to exclude persons with assignments for a particular day? Example dataManager.load(Person.class).query(“Select p from Person p where <> :day”)


yes, you can do that. Just turn around the query and select for the assignments. Then you put the person into the view, so that the persons are additionally collected.

Here is an example of that:

   .query(“select a from Assignment a where <> :day”)
   .viewProperties("day", "")

You could also try to use loadValues() from the DataManager API (see: DataManager - CUBA Platform. Developer’s Manual)


@mario Thanks for your response, the assignments attribute is actually on the person entity. What i want is really the persons who are unassigned for a particular day. I tried a similar approach to what you had given from the Person entity perspective and include the assignment attribute needed . This seems to be giving me the list I need.
Example: dataManager.load(Person.class)
.query(“e.type in (‘Student’) and (e.studyDay <> :day or e.studyDay is null)”)