Bidirectional Association

Model:

component("demo",
  dataElement("Country",
    field("city : DataElement<demo::City>")),
  dataElement("City",
    field("countries : DataElement<demo::Country>[1..*]")),
  relationship("association",
    end("demo::Country::city"),
    end("demo::City::country")))

CountryDetails:

class CountryDetails {
  private DataRef city;
}

CityDetails:

class CityDetails {
  private List<DataRef> countries;
}

CityFinderBean:

class CityFinderBean {
  SearchResult<CityData> findByCountryEq(ParameterContext<SearchDetails<CityFindByCountryEqDetails>> searchParameter) {
    SearchDetails<CityFindByCountryEqDetails> searchDetails = searchParameter.getValue();
    CityFindByCountryEqDetails details = searchDetails.getDetails()

    Query query = entityManager.createQuery("select o from City o where o.country.id = :Country");
    query.setParameter("Country", details.getCountry().getId());

    return fetchData(searchDetails, query);
  }
}