Shared Aggregation

Model:

component("demo",
  dataElement("Order",
    field("products : DataElement<demo::Product>[1..*]")),
  dataElement("Product",
    field("orders : DataElement<demo::Order>[0..*]")),
  relationship("shared_aggregation",
    end("demo::Order::products"),
    end("demo::Product::orders")))

OrderDetails:

class OrderDetails {
  private List<DataRef> products;
}

ProductDetails:

class ProductDetails {
  private List<DataRef> orders;
}

ProductFinderBean:

class ProductFinderBean {

  SearchResult<ProductData> findByOrderEq(ParameterContext<SearchDetails<ProductFindByOrderEqDetails>> searchParameter) {
    SearchDetails<ProductFindByOrderEqDetails> searchDetails = searchParameter.getValue();
    ProductFindByOrderEqDetails details = searchDetails.getDetails()

    Query query = entityManager.createQuery("select o.product from A_Order_Product o where o.order.id = :Order");
    query.setParameter("Order", details.getOrder().getId());

    return fetchData(searchDetails, query);
  }
  
}