Hi.
The HarmParameter class is like the OrderItem, but between HarmNotification and Parameter
In HarmNotification class i might have a lot of references to HarmParameter, some of them are scalar (Basic) or a Set.
So i can load a HarmNotification i need to classify which HarmParameter is goes for each of its refereces, because all are stored on HarmParameter table with the FK set to the Notification. The way i select which HarmParameter goes for each of its references is by restricting the associated ParameterType:
HarmNotification * <-> * HarmParameter -> Parameter (type)
So in my Customizer i did:
for each ForeignReferenceMapping mapping
HarmTypeJoin joinMapping = getMappingAnnotation(mapping, HarmTypeJoin.class); // Get the annotation from the mapping Field
if(joinMapping != null) {
ExpressionBuilder builder = new ExpressionBuilder(HarmParameter.class);
_expression_ parameter = builder.get("parameter");
parameter.getField("TP_PARAMETRO").equal(joinMapping.value());
mapping.setSelectionCriteria(builder);
}